static void msn_chat_invite( struct groupchat *c, char *who, char *message ) { struct msn_switchboard *sb = msn_sb_by_chat( c ); if( sb ) msn_sb_write( sb, "CAL %d %s\r\n", ++sb->trId, who ); }
static void msn_chat_leave( struct groupchat *c ) { struct msn_switchboard *sb = msn_sb_by_chat( c ); if( sb ) msn_sb_write( sb, "OUT\r\n" ); }
int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m ) { struct msn_data *md = ic->proto_data; struct msn_switchboard *sb; /* FIXME: *CHECK* the reliability of using spare sb's! */ if( ( sb = msn_sb_spare( ic ) ) ) { debug( "Trying to use a spare switchboard to message %s", m->who ); sb->who = g_strdup( m->who ); if( msn_sb_write( sb, "CAL %d %s\r\n", ++sb->trId, m->who ) ) { /* He/She should join the switchboard soon, let's queue the message. */ sb->msgq = g_slist_append( sb->msgq, m ); return( 1 ); } } debug( "Creating a new switchboard to message %s", m->who ); /* If we reach this line, there was no spare switchboard, so let's make one. */ if( !msn_ns_write( ic, -1, "XFR %d SB\r\n", ++md->trId ) ) { g_free( m->who ); g_free( m->text ); g_free( m ); return( 0 ); } /* And queue the message to md. We'll pick it up when the switchboard comes up. */ md->msgq = g_slist_append( md->msgq, m ); /* FIXME: If the switchboard creation fails, the message will not be sent. */ return( 1 ); }