Changeset a2b99ec for protocols/msn
- Timestamp:
- 2008-08-10T22:17:58Z (16 years ago)
- Branches:
- master
- Children:
- 92f4ec5
- Parents:
- 87f525e
- Location:
- protocols/msn
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/Makefile
r87f525e ra2b99ec 10 10 11 11 # [SH] Program variables 12 objects = msn.o msn_util.o ns.o passport.o sb.o tables.o 12 objects = msn.o msn_util.o ns.o passport.o sb.o tables.o invitation.o 13 13 14 14 CFLAGS += -Wall -
protocols/msn/msn.c
r87f525e ra2b99ec 77 77 if( md ) 78 78 { 79 while( md->filetransfers ) { 80 imcb_file_canceled( md->filetransfers->data, "Closing msn connection" ); 81 } 82 79 83 if( md->fd >= 0 ) 80 84 closesocket( md->fd ); … … 338 342 ret->send_typing = msn_send_typing; 339 343 ret->handle_cmp = g_strcasecmp; 344 ret->transfer_request = msn_ftp_transfer_request; 340 345 341 346 register_protocol(ret); -
protocols/msn/msn.h
r87f525e ra2b99ec 69 69 int sb_failures; 70 70 time_t first_sb_failure; 71 GSList *filetransfers; 71 72 72 73 const struct msn_away_state *away_state; … … 181 182 int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m ); 182 183 184 /* invitation.c */ 185 void msn_ftp_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *who ); 186 183 187 #endif //_MSN_H -
protocols/msn/sb.c
r87f525e ra2b99ec 29 29 #include "passport.h" 30 30 #include "md5.h" 31 #include "invitation.h" 31 32 32 33 static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond ); … … 168 169 169 170 /* Build the message. Convert LF to CR-LF for normal messages. */ 170 if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) != 0 ) 171 if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) == 0 ) 172 { 173 i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->acc->user ); 174 buf = g_new0( char, i ); 175 i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->acc->user ); 176 } else if( strncmp( text, MSN_INVITE_HEADERS, sizeof( MSN_INVITE_HEADERS ) - 1 ) == 0 ) 177 { 178 buf = g_strdup( text ); 179 i = strlen( buf ); 180 } else 171 181 { 172 182 buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 + 1 ); … … 181 191 buf[i++] = text[j]; 182 192 } 183 }184 else185 {186 i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->acc->user );187 buf = g_new0( char, i );188 i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->acc->user );189 193 } 190 194 … … 687 691 else if( g_strncasecmp( ct, "text/x-msmsgsinvite", 19 ) == 0 ) 688 692 { 689 char *itype = msn_findheader( body, "Application-GUID:", blen ); 690 char buf[1024]; 693 char *command = msn_findheader( body, "Invitation-Command:", blen ); 694 char *cookie = msn_findheader( body, "Invitation-Cookie:", blen ); 695 unsigned int icookie; 691 696 692 697 g_free( ct ); 693 698 694 *buf = 0; 695 696 if( !itype ) 697 return( 1 ); 698 699 /* File transfer. */ 700 if( strcmp( itype, "{5D3E02AB-6190-11d3-BBBB-00C04F795683}" ) == 0 ) 701 { 702 char *name = msn_findheader( body, "Application-File:", blen ); 703 char *size = msn_findheader( body, "Application-FileSize:", blen ); 704 705 if( name && size ) 706 { 707 g_snprintf( buf, sizeof( buf ), "<< \x02""BitlBee\x02"" - Filetransfer: `%s', %s bytes >>\n" 708 "Filetransfers are not supported by BitlBee for now...", name, size ); 709 } 710 else 711 { 712 strcpy( buf, "<< \x02""BitlBee\x02"" - Corrupted MSN filetransfer invitation message >>" ); 713 } 714 715 if( name ) g_free( name ); 716 if( size ) g_free( size ); 717 } 718 else 719 { 720 char *iname = msn_findheader( body, "Application-Name:", blen ); 721 722 g_snprintf( buf, sizeof( buf ), "<< \x02""BitlBee\x02"" - Unknown MSN invitation - %s (%s) >>", 723 itype, iname ? iname : "no name" ); 724 725 if( iname ) g_free( iname ); 726 } 727 728 g_free( itype ); 729 730 if( !*buf ) 731 return( 1 ); 732 733 if( sb->who ) 734 { 735 imcb_buddy_msg( ic, cmd[1], buf, 0, 0 ); 736 } 737 else if( sb->chat ) 738 { 739 imcb_chat_msg( sb->chat, cmd[1], buf, 0, 0 ); 740 } 741 else 742 { 743 /* PANIC! */ 744 } 699 /* Every invite should have both a Command and Cookie header */ 700 if( !command || !cookie ) { 701 g_free( command ); 702 g_free( cookie ); 703 imcb_log( ic, "Warning: No command or cookie from %s", sb->who ); 704 return 1; 705 } 706 707 icookie = strtoul( cookie, NULL, 10 ); 708 g_free( cookie ); 709 710 if( g_strncasecmp( command, "INVITE", 6 ) == 0 ) { 711 msn_invitation_invite( sb, cmd[1], icookie, body, blen ); 712 } else if( g_strncasecmp( command, "ACCEPT", 6 ) == 0 ) { 713 msn_invitation_accept( sb, cmd[1], icookie, body, blen ); 714 } else if( g_strncasecmp( command, "CANCEL", 6 ) == 0 ) { 715 msn_invitation_cancel( sb, cmd[1], icookie, body, blen ); 716 } else { 717 imcb_log( ic, "Warning: Received invalid invitation with " 718 "command %s from %s", command, sb->who ); 719 } 720 721 g_free( command ); 722 } 723 else if( g_strncasecmp( ct, "application/x-msnmsgrp2p", 24 ) == 0 ) 724 { 725 imcb_error( sb->ic, "Cannot receive file from %s: BitlBee does not " 726 "support msnmsgrp2p yet.", sb->who ); 727 g_free( ct ); 745 728 } 746 729 else if( g_strncasecmp( ct, "text/x-msmsgscontrol", 20 ) == 0 )
Note: See TracChangeset
for help on using the changeset viewer.