Changeset 3b09b38
- Timestamp:
- 2015-04-10T17:10:40Z (10 years ago)
- Branches:
- master
- Children:
- a4be2f6
- Parents:
- cfeadc3
- git-author:
- dequis <dx@…> (13-03-15 07:50:24)
- git-committer:
- dequis <dx@…> (10-04-15 17:10:40)
- Location:
- protocols/msn
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.h
rcfeadc3 r3b09b38 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
rcfeadc3 r3b09b38 172 172 } 173 173 174 /* *NOT* thread-safe, but that's not a problem for now... */175 char **msn_linesplit(char *line)176 {177 static char **ret = NULL;178 static int size = 3;179 int i, n = 0;180 181 if (ret == NULL) {182 ret = g_new0(char*, size);183 }184 185 for (i = 0; line[i] && line[i] == ' '; i++) {186 ;187 }188 if (line[i]) {189 ret[n++] = line + i;190 for (i++; line[i]; i++) {191 if (line[i] == ' ') {192 line[i] = 0;193 } else if (line[i] != ' ' && !line[i - 1]) {194 ret[n++] = line + i;195 }196 197 if (n >= size) {198 ret = g_renew(char*, ret, size += 2);199 }200 }201 }202 ret[n] = NULL;203 204 return(ret);205 }206 207 174 /* This one handles input from a MSN Messenger server. Both the NS and SB servers usually give 208 175 commands, but sometimes they give additional data (payload). This function tries to handle … … 243 210 244 211 cmd_text = g_strndup(h->rxq, i); 245 cmd = msn_linesplit(cmd_text); 246 for (count = 0; cmd[count]; count++) { 247 ; 248 } 212 cmd = g_strsplit_set(cmd_text, " ", -1); 213 count = g_strv_length(cmd); 214 249 215 st = msn_ns_command(h, cmd, count); 216 217 g_strfreev(cmd); 250 218 g_free(cmd_text); 251 219 … … 283 251 284 252 msg = g_strndup(h->rxq, h->msglen); 285 cmd = msn_linesplit(h->cmd_text); 286 for (count = 0; cmd[count]; count++) { 287 ; 288 } 253 254 cmd = g_strsplit_set(h->cmd_text, " ", -1); 255 count = g_strv_length(cmd); 289 256 290 257 st = msn_ns_message(h, msg, h->msglen, cmd, count); 258 259 g_strfreev(cmd); 291 260 g_free(msg); 292 261 g_free(h->cmd_text);
Note: See TracChangeset
for help on using the changeset viewer.