Changes in protocols/msn/msn.c [c6ca3ee:823de9d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
rc6ca3ee r823de9d 26 26 #include "nogaim.h" 27 27 #include "msn.h" 28 29 int msn_chat_id;30 GSList *msn_connections;31 GSList *msn_switchboards;32 28 33 29 static char *msn_set_display_name( set_t *set, char *value ); … … 117 113 { 118 114 struct msn_switchboard *sb; 119 struct msn_data *md = ic->proto_data;120 115 121 116 if( ( sb = msn_sb_by_handle( ic, who ) ) ) … … 126 121 { 127 122 struct msn_message *m; 128 char buf[1024];129 123 130 124 /* Create a message. We have to arrange a usable switchboard, and send the message later. */ … … 133 127 m->text = g_strdup( message ); 134 128 135 /* FIXME: *CHECK* the reliability of using spare sb's! */ 136 if( ( sb = msn_sb_spare( ic ) ) ) 137 { 138 debug( "Trying to use a spare switchboard to message %s", who ); 139 140 sb->who = g_strdup( who ); 141 g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who ); 142 if( msn_sb_write( sb, buf, strlen( buf ) ) ) 143 { 144 /* He/She should join the switchboard soon, let's queue the message. */ 145 sb->msgq = g_slist_append( sb->msgq, m ); 146 return( 1 ); 147 } 148 } 149 150 debug( "Creating a new switchboard to message %s", who ); 151 152 /* If we reach this line, there was no spare switchboard, so let's make one. */ 153 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId ); 154 if( !msn_write( ic, buf, strlen( buf ) ) ) 155 { 156 g_free( m->who ); 157 g_free( m->text ); 158 g_free( m ); 159 160 return( 0 ); 161 } 162 163 /* And queue the message to md. We'll pick it up when the switchboard comes up. */ 164 md->msgq = g_slist_append( md->msgq, m ); 165 166 /* FIXME: If the switchboard creation fails, the message will not be sent. */ 167 168 return( 1 ); 129 return msn_sb_write_msg( ic, m ); 169 130 } 170 131 … … 256 217 { 257 218 struct msn_switchboard *sb; 258 struct msn_data *md = ic->proto_data;259 char buf[1024];260 219 261 220 if( ( sb = msn_sb_by_handle( ic, who ) ) ) … … 267 226 { 268 227 struct msn_message *m; 269 270 if( ( sb = msn_sb_spare( ic ) ) )271 {272 debug( "Trying to reuse an existing switchboard as a groupchat with %s", who );273 g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who );274 if( msn_sb_write( sb, buf, strlen( buf ) ) )275 return msn_sb_to_chat( sb );276 }277 278 /* If the stuff above failed for some reason: */279 debug( "Creating a new switchboard to groupchat with %s", who );280 281 /* Request a new switchboard. */282 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );283 if( !msn_write( ic, buf, strlen( buf ) ) )284 return( 0 );285 228 286 229 /* Create a magic message. This is quite hackish, but who cares? :-P */ … … 289 232 m->text = g_strdup( GROUPCHAT_SWITCHBOARD_MESSAGE ); 290 233 291 /* Queue the magic message and cross your fingers. */ 292 md->msgq = g_slist_append( md->msgq, m ); 293 294 /* FIXME: Can I try to return something here already? */ 234 msn_sb_write_msg( ic, m ); 235 295 236 return NULL; 296 237 } … … 376 317 377 318 ret->name = "msn"; 319 ret->mms = 1409; /* this guess taken from libotr UPGRADING file */ 378 320 ret->login = msn_login; 379 321 ret->init = msn_init;
Note: See TracChangeset
for help on using the changeset viewer.