Mercurial > pidgin
comparison libpurple/protocols/msn/msn.c @ 27482:8accf7a2264c
The MSN client and server strips leading and trailing whitespace, so do the
same locally before setting it, so that people don't think that their name
actually included any.
Also, there's no need to call strlen() to check that the length > 0.
Fixes #9447 in a way.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 12 Jul 2009 05:06:45 +0000 |
parents | d375ef85519f |
children | 3698c7f4d803 |
comparison
equal
deleted
inserted
replaced
27481:444542a43790 | 27482:8accf7a2264c |
---|---|
176 | 176 |
177 session = gc->proto_data; | 177 session = gc->proto_data; |
178 cmdproc = session->notification->cmdproc; | 178 cmdproc = session->notification->cmdproc; |
179 account = purple_connection_get_account(gc); | 179 account = purple_connection_get_account(gc); |
180 | 180 |
181 if(entry && strlen(entry)) | 181 if (entry && *entry) |
182 alias = purple_url_encode(entry); | 182 { |
183 char *tmp = g_strdup(entry); | |
184 alias = purple_url_encode(g_strstrip(tmp)); | |
185 g_free(tmp); | |
186 } | |
183 else | 187 else |
184 alias = ""; | 188 alias = ""; |
185 | 189 |
186 if (strlen(alias) > BUDDY_ALIAS_MAXLEN) | 190 if (strlen(alias) > BUDDY_ALIAS_MAXLEN) |
187 { | 191 { |
193 if (*alias == '\0') { | 197 if (*alias == '\0') { |
194 alias = purple_url_encode(purple_account_get_username(account)); | 198 alias = purple_url_encode(purple_account_get_username(account)); |
195 } | 199 } |
196 | 200 |
197 msn_cmdproc_send(cmdproc, "PRP", "MFN %s", alias); | 201 msn_cmdproc_send(cmdproc, "PRP", "MFN %s", alias); |
198 | |
199 } | 202 } |
200 | 203 |
201 static void | 204 static void |
202 msn_set_prp(PurpleConnection *gc, const char *type, const char *entry) | 205 msn_set_prp(PurpleConnection *gc, const char *type, const char *entry) |
203 { | 206 { |