1 message in net.sourceforge.lists.courier-sqwebmail[sqwebmail] Hardcoded max length for ...
FromSent OnAttachments
Pawel TeczaFeb 20, 2007 5:18 am.patch
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[sqwebmail] Hardcoded max length for newmsg headersActions...
From:Pawel Tecza (pte@uw.edu.pl)
Date:Feb 20, 2007 5:18:15 am
List:net.sourceforge.lists.courier-sqwebmail
Attachments:

Hello Sam,

Probably you've just noticed that I have inimitable users ;) One of them has many nicknames in his address book and he can't send a message to many nicknames. There are 2 reasons of the problem:

1. all of his nicknames have very long name :D, 2. a max length of new message headers is "only" 512 characters now.

I know how to work around it using JavaScript code, but I think that max length of header can be more customizable. Of course, we can do it via appropriate variable in the newmsg.html template :)

I'm attaching my patch and I hope you like it ;)

My best regards,

Pawel

Index: webmail/newmsg.c =================================================================== RCS file: /cvsroot/courier/courier/webmail/newmsg.c,v retrieving revision 1.63 diff -u -r1.63 newmsg.c --- webmail/newmsg.c 2 Feb 2007 23:40:50 -0000 1.63 +++ webmail/newmsg.c 20 Feb 2007 12:48:49 -0000 @@ -70,6 +70,12 @@ static void newmsg_header(const char *label, const char *field, const char *encoded, const char *val) { +int hdrmaxlen=512; +const char *p=getarg("HDRMAXLEN"); + + if (p && (atoi(p) > hdrmaxlen)) + hdrmaxlen=atoi(p); + #if HAVE_SQWEBMAIL_UNICODE const struct unicode_info *uiptr=unicode_find(sqwebmail_content_charset); #endif @@ -78,9 +84,9 @@ "<td width=\"6\">&nbsp;</td>", field, label);

- printf("<td><input type=\"text\" name=\"%s\" size=\"50\" maxlength=\"512\"" + printf("<td><input type=\"text\" name=\"%s\" size=\"50\" maxlength=\"%d\"" " class=\"new-message-header-text\" value=\"", - field); + field, hdrmaxlen); if (encoded) { char *s; @@ -118,14 +124,20 @@ const char *encoded, const char *val, int is_readonly) { +int hdrmaxlen=512; +const char *p=getarg("HDRMAXLEN"); + + if (p && (atoi(p) > hdrmaxlen)) + hdrmaxlen=atoi(p); + printf("<tr><th align=\"right\"><p class=\"new-message-header\">" "<span class=\"new-message-header-%s\">%s</span></p></th>" "<td width=\"6\">&nbsp;</td>", field, label);

- printf("<td><input type=\"text\" name=\"%s\" size=\"50\" maxlength=\"512\"" + printf("<td><input type=\"text\" name=\"%s\" size=\"50\" maxlength=\"%d\"" " class=\"new-message-header-text\" value=\"", - field); + field, hdrmaxlen); if (encoded) { struct rfc822t *t=rfc822t_alloc_new(encoded, NULL, NULL); Index: webmail/html/en-us/newmsg.html =================================================================== RCS file: /cvsroot/courier/courier/webmail/html/en-us/newmsg.html,v retrieving revision 1.43 diff -u -r1.43 newmsg.html --- webmail/html/en-us/newmsg.html 22 Jul 2006 21:54:00 -0000 1.43 +++ webmail/html/en-us/newmsg.html 20 Feb 2007 12:54:56 -0000 @@ -59,6 +59,7 @@ [#$TEXT1=<textarea name="message" cols="76" rows="15" wrap="soft"
class="new-message-message-text">#] [#$TEXT2=</textarea><br />#]

+[#$HDRMAXLEN=512#] --> <script type="text/javascript" language="Javascript"> <!--