Changeset 46dca11


Ignore:
Timestamp:
2008-01-06T12:32:27Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
43462708
Parents:
1febf5c
Message:

Changed warning message about unsent MSN messages. It should show the actual
message(s) now.

Location:
protocols/msn
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.c

    r1febf5c r46dca11  
    9090                        msn_sb_destroy( md->switchboards->data );
    9191               
    92                 if( md->msgq )
    93                 {
    94                         struct msn_message *m;
    95                        
    96                         for( l = md->msgq; l; l = l->next )
    97                         {
    98                                 m = l->data;
    99                        
    100                                 imcb_log( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
    101                                 g_free( m->who );
    102                                 g_free( m->text );
    103                                 g_free( m );
    104                         }
    105                         g_slist_free( md->msgq );
    106                 }
     92                msn_msgq_purge( ic, &md->msgq );
    10793               
    10894                while( md->groupcount > 0 )
  • protocols/msn/msn.h

    r1febf5c r46dca11  
    158158int msn_handler( struct msn_handler_data *h );
    159159char *msn_http_encode( const char *input );
     160void msn_msgq_purge( struct im_connection *ic, GSList **list );
    160161
    161162/* tables.c */
  • protocols/msn/msn_util.c

    r1febf5c r46dca11  
    339339        return ret;
    340340}
     341
     342void msn_msgq_purge( struct im_connection *ic, GSList **list )
     343{
     344        struct msn_message *m;
     345        GString *ret;
     346        GSList *l;
     347       
     348        l = *list;
     349        if( l == NULL )
     350                return;
     351       
     352        m = l->data;
     353        ret = g_string_sized_new( 1024 );
     354        g_string_printf( ret, "WARNING: Cleaning up MSN (switchboard) connection with unsent "
     355                              "messages to %s:", m->who ? m->who : "unknown recipient" );
     356       
     357        while( l )
     358        {
     359                m = l->data;
     360               
     361                g_string_append_printf( ret, "\n%s", m->text );
     362               
     363                g_free( m->who );
     364                g_free( m->text );
     365                g_free( m );
     366               
     367                l = l->next;
     368        }
     369        g_slist_free( *list );
     370        *list = NULL;
     371       
     372        imcb_log( ic, ret->str );
     373        g_string_free( ret, TRUE );
     374}
  • protocols/msn/sb.c

    r1febf5c r46dca11  
    128128                if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) != 0 )
    129129                {
    130                         buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 );
     130                        buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 + 1 );
    131131                        i = strlen( MSN_MESSAGE_HEADERS );
    132132                       
     
    207207        debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" );
    208208       
    209         if( sb->msgq )
    210         {
    211                 struct msn_message *m;
    212                 GSList *l;
    213                
    214                 for( l = sb->msgq; l; l = l->next )
    215                 {
    216                         m = l->data;
    217 
    218                         g_free( m->who );
    219                         g_free( m->text );
    220                         g_free( m );
    221                 }
    222                 g_slist_free( sb->msgq );
    223                
    224                 imcb_log( ic, "Warning: Closing down MSN switchboard connection with "
    225                                    "unsent message to %s, you'll have to resend it.",
    226                                    sb->who ? sb->who : "(unknown)" );
    227         }
     209        msn_msgq_purge( ic, &sb->msgq );
    228210       
    229211        if( sb->key ) g_free( sb->key );
     
    266248        if( source != sb->fd )
    267249        {
    268                 debug( "ERROR %d while connecting to switchboard server", 1 );
     250                debug( "Error %d while connecting to switchboard server", 1 );
    269251                msn_sb_destroy( sb );
    270252                return FALSE;
     
    287269                sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );
    288270        else
    289                 debug( "ERROR %d while connecting to switchboard server", 2 );
     271                debug( "Error %d while connecting to switchboard server", 2 );
    290272       
    291273        return FALSE;
     
    298280        if( msn_handler( sb->handler ) == -1 )
    299281        {
    300                 debug( "ERROR: Switchboard died" );
     282                debug( "Error: Switchboard died" );
    301283                msn_sb_destroy( sb );
    302284               
     
    555537                        if( sb->who )
    556538                        {
    557                                 struct msn_message *m;
    558                                 GSList *l;
    559                                
    560539                                /* Apparently some invitation failed. We might want to use this
    561540                                   board later, so keep it as a spare. */
     
    564543                               
    565544                                /* Also clear the msgq, otherwise someone else might get them. */
    566                                 for( l = sb->msgq; l; l = l->next )
    567                                 {
    568                                         m = l->data;
    569                                         g_free( m->who );
    570                                         g_free( m->text );
    571                                         g_free( m );
    572                                 }
    573                                 g_slist_free( sb->msgq );
    574                                 sb->msgq = NULL;
     545                                msn_msgq_purge( ic, &sb->msgq );
    575546                        }
    576547                       
Note: See TracChangeset for help on using the changeset viewer.