aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/yahoo/yahoo_util.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-04-15 21:31:52 -0700
committerWilmer van der Gaast <wilmer@gaast.net>2007-04-15 21:31:52 -0700
commitcfc8d58f4c15048e943800272017f69804bb61b7 (patch)
treeb777cadc8b97774db995f449a81ed34fe10fe800 /protocols/yahoo/yahoo_util.c
parent6bbb939e953bbe1ca9ed3101a1569abe4521f543 (diff)
Updating the Yahoo! module. This seems to fix handling of incoming away
states/messages, should fix some issues with group chats, and unfortunately also adds some crap which I don't want to clean up for now.
Diffstat (limited to 'protocols/yahoo/yahoo_util.c')
-rw-r--r--protocols/yahoo/yahoo_util.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/protocols/yahoo/yahoo_util.c b/protocols/yahoo/yahoo_util.c
index 7babfa49..5375205f 100644
--- a/protocols/yahoo/yahoo_util.c
+++ b/protocols/yahoo/yahoo_util.c
@@ -68,13 +68,15 @@ char ** y_strsplit(char * str, char * sep, int nelem)
char *s, *p;
int i=0;
int l = strlen(sep);
- if(nelem < 0) {
+ if(nelem <= 0) {
char * s;
nelem=0;
- for(s=strstr(str, sep); s; s=strstr(s+l, sep),nelem++)
- ;
- if(strcmp(str+strlen(str)-l, sep))
- nelem++;
+ if (*str) {
+ for(s=strstr(str, sep); s; s=strstr(s+l, sep),nelem++)
+ ;
+ if(strcmp(str+strlen(str)-l, sep))
+ nelem++;
+ }
}
vector = y_new(char *, nelem + 1);
@@ -86,7 +88,7 @@ char ** y_strsplit(char * str, char * sep, int nelem)
vector[i][len] = '\0';
}
- if(i<nelem) /* str didn't end with sep */
+ if(i<nelem && *str) /* str didn't end with sep, and str isn't empty */
vector[i++] = strdup(p);
vector[i] = NULL;