Changeset 87f525e for protocols/msn/sb.c


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/sb.c

    r8661caa r87f525e  
    4444                return( 0 );
    4545        }
     46       
     47        return( 1 );
     48}
     49
     50int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m )
     51{
     52        struct msn_data *md = ic->proto_data;
     53        struct msn_switchboard *sb;
     54        char buf[1024];
     55
     56        /* FIXME: *CHECK* the reliability of using spare sb's! */
     57        if( ( sb = msn_sb_spare( ic ) ) )
     58        {
     59                debug( "Trying to use a spare switchboard to message %s", m->who );
     60               
     61                sb->who = g_strdup( m->who );
     62                g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, m->who );
     63                if( msn_sb_write( sb, buf, strlen( buf ) ) )
     64                {
     65                        /* He/She should join the switchboard soon, let's queue the message. */
     66                        sb->msgq = g_slist_append( sb->msgq, m );
     67                        return( 1 );
     68                }
     69        }
     70       
     71        debug( "Creating a new switchboard to message %s", m->who );
     72       
     73        /* If we reach this line, there was no spare switchboard, so let's make one. */
     74        g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
     75        if( !msn_write( ic, buf, strlen( buf ) ) )
     76        {
     77                g_free( m->who );
     78                g_free( m->text );
     79                g_free( m );
     80               
     81                return( 0 );
     82        }
     83       
     84        /* And queue the message to md. We'll pick it up when the switchboard comes up. */
     85        md->msgq = g_slist_append( md->msgq, m );
     86       
     87        /* FIXME: If the switchboard creation fails, the message will not be sent. */
    4688       
    4789        return( 1 );
Note: See TracChangeset for help on using the changeset viewer.