[Telepathy-commits] [telepathy-idle/master] Assume worst-case relay prefix before we get user info
Jonathon Jongsma
jonathon.jongsma at collabora.co.uk
Fri Feb 13 21:20:35 PST 2009
Finding from wjt's review. I wasn't able to find a max limit on userlength, but
the 3 IRC servers that I tested (freenode, gimpnet, and ircd-hybrid on localhost
as shipped by debian) all had limits between 8-10 characters. I added a little
padding and made username worst-case 18 chars.
---
src/idle-connection.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/src/idle-connection.c b/src/idle-connection.c
index 5d9b6d4..84e57e7 100644
--- a/src/idle-connection.c
+++ b/src/idle-connection.c
@@ -706,7 +706,15 @@ idle_connection_get_max_message_length(IdleConnection *conn)
* other users. the +2 is for the initial : and the trailing space */
return IRC_MSG_MAXLEN - (strlen(priv->relay_prefix) + 2);
}
- return IRC_MSG_MAXLEN;
+ /* Before we've gotten our user info, we don't know how long our relay
+ * prefix will be, so just assume worst-case. The max possible prefix is:
+ * ':<15 char nick>!<? char username>@<63 char hostname> ' == 1 + 15 + 1 + ?
+ * + 1 + 63 + 1 == 82 + ?
+ * I haven't been able to find a definitive reference for the max username
+ * length, but the testing I've done seems to indicate that 8-10 is a
+ * common limit. I'll add some extra buffer to be safe.
+ * */
+ return IRC_MSG_MAXLEN - 100;
}
static IdleParserHandlerResult _erroneous_nickname_handler(IdleParser *parser, IdleParserMessageCode code, GValueArray *args, gpointer user_data) {
--
1.5.6.5
More information about the telepathy-commits
mailing list