Changeset e6ef4a8
- Timestamp:
- 2015-03-15T14:41:48Z (10 years ago)
- Children:
- c408298
- Parents:
- e2bf725
- git-author:
- dequis <dx@…> (13-03-15 07:50:24)
- git-committer:
- dequis <dx@…> (15-03-15 14:41:48)
- Location:
- protocols/msn
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.h
re2bf725 re6ef4a8 248 248 int msn_buddy_list_remove(struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *group); 249 249 void msn_buddy_ask(bee_user_t *bu); 250 char **msn_linesplit(char *line);251 250 int msn_handler(struct msn_data *h); 252 251 char *msn_p11_challenge(char *challenge); -
protocols/msn/msn_util.c
re2bf725 re6ef4a8 166 166 } 167 167 168 /* *NOT* thread-safe, but that's not a problem for now... */169 char **msn_linesplit(char *line)170 {171 static char **ret = NULL;172 static int size = 3;173 int i, n = 0;174 175 if (ret == NULL) {176 ret = g_new0(char*, size);177 }178 179 for (i = 0; line[i] && line[i] == ' '; i++) {180 ;181 }182 if (line[i]) {183 ret[n++] = line + i;184 for (i++; line[i]; i++) {185 if (line[i] == ' ') {186 line[i] = 0;187 } else if (line[i] != ' ' && !line[i - 1]) {188 ret[n++] = line + i;189 }190 191 if (n >= size) {192 ret = g_renew(char*, ret, size += 2);193 }194 }195 }196 ret[n] = NULL;197 198 return(ret);199 }200 201 168 /* This one handles input from a MSN Messenger server. Both the NS and SB servers usually give 202 169 commands, but sometimes they give additional data (payload). This function tries to handle … … 237 204 238 205 cmd_text = g_strndup(h->rxq, i); 239 cmd = msn_linesplit(cmd_text); 240 for (count = 0; cmd[count]; count++) { 241 ; 242 } 206 cmd = g_strsplit_set(cmd_text, " ", -1); 207 count = g_strv_length(cmd); 208 243 209 st = msn_ns_command(h, cmd, count); 210 211 g_strfreev(cmd); 244 212 g_free(cmd_text); 245 213 … … 277 245 278 246 msg = g_strndup(h->rxq, h->msglen); 279 cmd = msn_linesplit(h->cmd_text); 280 for (count = 0; cmd[count]; count++) { 281 ; 282 } 247 248 cmd = g_strsplit_set(h->cmd_text, " ", -1); 249 count = g_strv_length(cmd); 283 250 284 251 st = msn_ns_message(h, msg, h->msglen, cmd, count); 252 253 g_strfreev(cmd); 285 254 g_free(msg); 286 255 g_free(h->cmd_text);
Note: See TracChangeset
for help on using the changeset viewer.