small issue with lock_author_names
local.coder
code at novageeks.org
Thu Dec 27 03:38:39 CET 2007
The username comes from two different places on that web page.
For the top header it's a simple read of the string from the authdata.
This is from cgiutils.c
if(current_authdata!=NULL)
printf("Logged in as
<i>%s</i><BR>\n",(!strcmp(current_authdata->username,""))?"?":current_authdata->username);
in cmd.c Author for the form portion is set through a multi-step process.
printf("<INPUT TYPE='TEXT' NAME='com_author' VALUE='%s'
%s>",comment_author,(lock_author_names==TRUE)?"READONLY DISABLED":
"");
And comment_author is set earlier in the c file by.
/* get name to use for author */
if(lock_author_names==TRUE){
temp_contact=find_contact(current_authdata.username);
if(temp_contact!=NULL && temp_contact->alias!=NULL)
comment_author=temp_contact->alias;
else
comment_author=current_authdata.username;
}
find_contact is based out of common/objects.c
contact * find_contact(char *name){
contact *temp_contact=NULL;
if(name==NULL || contact_hashlist==NULL)
return NULL;
for(temp_contact=contact_hashlist[hashfunc(name,NULL,CONTACT_HASHSLOTS)];temp_contact &&
compare_hashdata(temp_contact->name,NULL,
name,NULL)<0;temp_contact=temp_contact->nexthash);
if(temp_contact &&
(compare_hashdata(temp_contact->name,NULL,name,NULL)==0))
return temp_contact;
/* we couldn't find a matching contact */
return NULL;
}
I haven't taken a long look at what find_contact is doing that is
causing your issue but I would guess that with a change shown below
your problem should go away. It's not the right fix but it will work
for you (this just removes the find_contact functionality for that box).
if(temp_contact!=NULL && temp_contact->alias!=NULL)
comment_author=current_authdata.username;
else
comment_author=current_authdata.username;
}
I am sure Ethan can quickly figure why find_contact is causing the
string to get cut off but I am not seeing it on quick glance.
Good luck,
Derrick
Quoting Wolfgang Barth <wob at swobspace.de>:
> On Wed, Dec 26, 2007 at 09:50:45AM -0600, Ethan Galstad wrote:
>
>> Hmm.. I don't see anywhere in the code where the author name would be
>> clipped for the forms in cmd.cgi. Is this just a visual problem with
>> the text box not being wide enough or is the last part of the author
>> name missing once the command is submitted as well?
>
> The textbox seems to be wide enough, I think the part after the first dot
> is skipped, see the attached image (setting acknowledge with cmd.cgi):
>
> - the box above shows barthw at ELI.ST-ELISABETH.DE (the correct login name)
> - the field Author is filled with barthw at ELI
> - the final comment after this action also shows barthw at ELI.
>
> Wolfgang
> --
> <wob (at) swobspace de> * http://www.swobspace.de
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
More information about the Developers
mailing list