aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/xmltree.c20
-rw-r--r--lib/xmltree.h1
-rw-r--r--protocols/msn/ns.c16
-rw-r--r--protocols/msn/sb.c12
4 files changed, 32 insertions, 17 deletions
diff --git a/lib/xmltree.c b/lib/xmltree.c
index b0a945ce..00b37ae6 100644
--- a/lib/xmltree.c
+++ b/lib/xmltree.c
@@ -549,6 +549,26 @@ void xt_add_child( struct xt_node *parent, struct xt_node *child )
}
}
+/* Same, but at the beginning. */
+void xt_insert_child( struct xt_node *parent, struct xt_node *child )
+{
+ struct xt_node *node, *last;
+
+ for( node = child; node; node = node->next )
+ {
+ if( node->parent != NULL )
+ {
+ /* ERROR CONDITION: They seem to have a parent already??? */
+ }
+
+ node->parent = parent;
+ last = node;
+ }
+
+ last->next = parent->children;
+ parent->children = child;
+}
+
void xt_add_attr( struct xt_node *node, const char *key, const char *value )
{
int i;
diff --git a/lib/xmltree.h b/lib/xmltree.h
index 34e3be68..ddb3f02f 100644
--- a/lib/xmltree.h
+++ b/lib/xmltree.h
@@ -91,6 +91,7 @@ char *xt_find_attr( struct xt_node *node, const char *key );
struct xt_node *xt_new_node( char *name, const char *text, struct xt_node *children );
void xt_add_child( struct xt_node *parent, struct xt_node *child );
+void xt_insert_child( struct xt_node *parent, struct xt_node *child );
void xt_add_attr( struct xt_node *node, const char *key, const char *value );
int xt_remove_attr( struct xt_node *node, const char *key );
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index 3e02e328..2d40b47b 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -227,13 +227,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
}
else if( strcmp( cmd[2], "OK" ) == 0 )
{
- if( num_parts == 7 )
- msn_ns_got_display_name( ic, cmd[4] );
- else
- imcb_log( ic, "Warning: Friendly name in server response was corrupted" );
-
imcb_log( ic, "Authenticated, getting buddy list" );
-
msn_soap_memlist_request( ic );
}
else
@@ -245,7 +239,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
}
else if( strcmp( cmd[0], "MSG" ) == 0 )
{
- if( num_parts != 4 )
+ if( num_parts < 4 )
{
imcb_error( ic, "Syntax error" );
imc_logout( ic, TRUE );
@@ -347,7 +341,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
{
const struct msn_away_state *st;
- if( num_parts != 5 )
+ if( num_parts < 5 )
{
imcb_error( ic, "Syntax error" );
imc_logout( ic, TRUE );
@@ -376,7 +370,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
char *server;
int session, port;
- if( num_parts != 7 )
+ if( num_parts < 7 )
{
imcb_error( ic, "Syntax error" );
imc_logout( ic, TRUE );
@@ -420,7 +414,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
}
else if( strcmp( cmd[0], "ADD" ) == 0 )
{
- if( num_parts == 6 && strcmp( cmd[2], "RL" ) == 0 )
+ if( num_parts >= 6 && strcmp( cmd[2], "RL" ) == 0 )
{
GSList *l;
@@ -484,7 +478,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
and since MSN servers can apparently screw up the formatting. */
else if( strcmp( cmd[0], "REA" ) == 0 )
{
- if( num_parts != 5 )
+ if( num_parts < 5 )
{
imcb_error( ic, "Syntax error" );
imc_logout( ic, TRUE );
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c
index 07e94072..b718d4e8 100644
--- a/protocols/msn/sb.c
+++ b/protocols/msn/sb.c
@@ -413,7 +413,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
}
else if( strcmp( cmd[0], "USR" ) == 0 )
{
- if( num_parts != 5 )
+ if( num_parts < 5 )
{
msn_sb_destroy( sb );
return( 0 );
@@ -439,7 +439,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
{
int num, tot;
- if( num_parts != 6 )
+ if( num_parts < 6 )
{
msn_sb_destroy( sb );
return( 0 );
@@ -476,7 +476,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
}
else if( strcmp( cmd[0], "ANS" ) == 0 )
{
- if( num_parts != 3 )
+ if( num_parts < 3 )
{
msn_sb_destroy( sb );
return( 0 );
@@ -495,7 +495,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
}
else if( strcmp( cmd[0], "CAL" ) == 0 )
{
- if( num_parts != 4 || !isdigit( cmd[3][0] ) )
+ if( num_parts < 4 || !isdigit( cmd[3][0] ) )
{
msn_sb_destroy( sb );
return( 0 );
@@ -505,7 +505,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
}
else if( strcmp( cmd[0], "JOI" ) == 0 )
{
- if( num_parts != 3 )
+ if( num_parts < 3 )
{
msn_sb_destroy( sb );
return( 0 );
@@ -566,7 +566,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
}
else if( strcmp( cmd[0], "MSG" ) == 0 )
{
- if( num_parts != 4 )
+ if( num_parts < 4 )
{
msn_sb_destroy( sb );
return( 0 );