Ignore:
Timestamp:
2008-08-10T10:42:52Z (16 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
a2b99ec
Parents:
8661caa (diff), a830512 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged in upstream r416 which includes my msn_write_msg patch. w00t! ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.c

    r8661caa r87f525e  
    113113{
    114114        struct msn_switchboard *sb;
    115         struct msn_data *md = ic->proto_data;
    116115       
    117116        if( ( sb = msn_sb_by_handle( ic, who ) ) )
     
    122121        {
    123122                struct msn_message *m;
    124                 char buf[1024];
    125123               
    126124                /* Create a message. We have to arrange a usable switchboard, and send the message later. */
     
    129127                m->text = g_strdup( message );
    130128               
    131                 /* FIXME: *CHECK* the reliability of using spare sb's! */
    132                 if( ( sb = msn_sb_spare( ic ) ) )
    133                 {
    134                         debug( "Trying to use a spare switchboard to message %s", who );
    135                        
    136                         sb->who = g_strdup( who );
    137                         g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who );
    138                         if( msn_sb_write( sb, buf, strlen( buf ) ) )
    139                         {
    140                                 /* He/She should join the switchboard soon, let's queue the message. */
    141                                 sb->msgq = g_slist_append( sb->msgq, m );
    142                                 return( 1 );
    143                         }
    144                 }
    145                
    146                 debug( "Creating a new switchboard to message %s", who );
    147                
    148                 /* If we reach this line, there was no spare switchboard, so let's make one. */
    149                 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
    150                 if( !msn_write( ic, buf, strlen( buf ) ) )
    151                 {
    152                         g_free( m->who );
    153                         g_free( m->text );
    154                         g_free( m );
    155                        
    156                         return( 0 );
    157                 }
    158                
    159                 /* And queue the message to md. We'll pick it up when the switchboard comes up. */
    160                 md->msgq = g_slist_append( md->msgq, m );
    161                
    162                 /* FIXME: If the switchboard creation fails, the message will not be sent. */
    163                
    164                 return( 1 );
     129                return msn_sb_write_msg( ic, m );
    165130        }
    166131       
     
    252217{
    253218        struct msn_switchboard *sb;
    254         struct msn_data *md = ic->proto_data;
    255         char buf[1024];
    256219       
    257220        if( ( sb = msn_sb_by_handle( ic, who ) ) )
     
    263226        {
    264227                struct msn_message *m;
    265                
    266                 if( ( sb = msn_sb_spare( ic ) ) )
    267                 {
    268                         debug( "Trying to reuse an existing switchboard as a groupchat with %s", who );
    269                         g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who );
    270                         if( msn_sb_write( sb, buf, strlen( buf ) ) )
    271                                 return msn_sb_to_chat( sb );
    272                 }
    273                
    274                 /* If the stuff above failed for some reason: */
    275                 debug( "Creating a new switchboard to groupchat with %s", who );
    276                
    277                 /* Request a new switchboard. */
    278                 g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
    279                 if( !msn_write( ic, buf, strlen( buf ) ) )
    280                         return( 0 );
    281228               
    282229                /* Create a magic message. This is quite hackish, but who cares? :-P */
     
    285232                m->text = g_strdup( GROUPCHAT_SWITCHBOARD_MESSAGE );
    286233               
    287                 /* Queue the magic message and cross your fingers. */
    288                 md->msgq = g_slist_append( md->msgq, m );
    289                
    290                 /* FIXME: Can I try to return something here already? */
     234                msn_sb_write_msg( ic, m );
     235
    291236                return NULL;
    292237        }
Note: See TracChangeset for help on using the changeset viewer.