Changeset 823de9d for protocols/msn/sb.c
- Timestamp:
- 2009-03-12T19:10:06Z (16 years ago)
- Branches:
- master
- Children:
- 673a54c
- Parents:
- 9b55485
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/sb.c
r9b55485 r823de9d 44 44 return( 0 ); 45 45 } 46 47 return( 1 ); 48 } 49 50 int 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. */ 46 88 47 89 return( 1 );
Note: See TracChangeset
for help on using the changeset viewer.