Changeset 9b0ad7e for protocols/msn
- Timestamp:
- 2011-12-19T00:00:31Z (13 years ago)
- Branches:
- master
- Children:
- bf57cd1
- Parents:
- 64b6635
- Location:
- protocols/msn
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.h
r64b6635 r9b0ad7e 234 234 int msn_buddy_list_remove( struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *group ); 235 235 void msn_buddy_ask( bee_user_t *bu ); 236 char *msn_findheader( char *text, char *header, int len );237 236 char **msn_linesplit( char *line ); 238 237 int msn_handler( struct msn_handler_data *h ); -
protocols/msn/msn_util.c
r64b6635 r9b0ad7e 226 226 bu->handle, bu->fullname ); 227 227 imcb_ask( bu->ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no ); 228 }229 230 char *msn_findheader( char *text, char *header, int len )231 {232 int hlen = strlen( header ), i;233 char *ret;234 235 if( len == 0 )236 len = strlen( text );237 238 i = 0;239 while( ( i + hlen ) < len )240 {241 /* Maybe this is a bit over-commented, but I just hate this part... */242 if( g_strncasecmp( text + i, header, hlen ) == 0 )243 {244 /* Skip to the (probable) end of the header */245 i += hlen;246 247 /* Find the first non-[: \t] character */248 while( i < len && ( text[i] == ':' || text[i] == ' ' || text[i] == '\t' ) ) i ++;249 250 /* Make sure we're still inside the string */251 if( i >= len ) return( NULL );252 253 /* Save the position */254 ret = text + i;255 256 /* Search for the end of this line */257 while( i < len && text[i] != '\r' && text[i] != '\n' ) i ++;258 259 /* Make sure we're still inside the string */260 if( i >= len ) return( NULL );261 262 /* Copy the found data */263 return( g_strndup( ret, text + i - ret ) );264 }265 266 /* This wasn't the header we were looking for, skip to the next line. */267 while( i < len && ( text[i] != '\r' && text[i] != '\n' ) ) i ++;268 while( i < len && ( text[i] == '\r' || text[i] == '\n' ) ) i ++;269 270 /* End of headers? */271 if( ( i >= 4 && strncmp( text + i - 4, "\r\n\r\n", 4 ) == 0 ) ||272 ( i >= 2 && ( strncmp( text + i - 2, "\n\n", 2 ) == 0 ||273 strncmp( text + i - 2, "\r\r", 2 ) == 0 ) ) )274 {275 break;276 }277 }278 279 return( NULL );280 228 } 281 229 -
protocols/msn/ns.c
r64b6635 r9b0ad7e 609 609 if( g_strcasecmp( cmd[1], "Hotmail" ) == 0 ) 610 610 { 611 char *ct = msn_findheader( msg, "Content-Type:", msglen );611 char *ct = get_rfc822_header( msg, "Content-Type:", msglen ); 612 612 613 613 if( !ct ) … … 622 622 return( 1 ); 623 623 624 mtype = msn_findheader( body, "Type:", blen );625 arg1 = msn_findheader( body, "Arg1:", blen );624 mtype = get_rfc822_header( body, "Type:", blen ); 625 arg1 = get_rfc822_header( body, "Arg1:", blen ); 626 626 627 627 if( mtype && strcmp( mtype, "1" ) == 0 ) … … 642 642 if( set_getbool( &ic->acc->set, "mail_notifications" ) ) 643 643 { 644 char *inbox = msn_findheader( body, "Inbox-Unread:", blen );645 char *folders = msn_findheader( body, "Folders-Unread:", blen );644 char *inbox = get_rfc822_header( body, "Inbox-Unread:", blen ); 645 char *folders = get_rfc822_header( body, "Folders-Unread:", blen ); 646 646 647 647 if( inbox && folders ) … … 656 656 if( set_getbool( &ic->acc->set, "mail_notifications" ) ) 657 657 { 658 char *from = msn_findheader( body, "From-Addr:", blen );659 char *fromname = msn_findheader( body, "From:", blen );658 char *from = get_rfc822_header( body, "From-Addr:", blen ); 659 char *fromname = get_rfc822_header( body, "From:", blen ); 660 660 661 661 if( from && fromname ) -
protocols/msn/sb.c
r64b6635 r9b0ad7e 682 682 if( strcmp( cmd[0], "MSG" ) == 0 ) 683 683 { 684 char *ct = msn_findheader( msg, "Content-Type:", msglen );684 char *ct = get_rfc822_header( msg, "Content-Type:", msglen ); 685 685 686 686 if( !ct ) … … 711 711 else if( g_strncasecmp( ct, "text/x-msmsgsinvite", 19 ) == 0 ) 712 712 { 713 char *command = msn_findheader( body, "Invitation-Command:", blen );714 char *cookie = msn_findheader( body, "Invitation-Cookie:", blen );713 char *command = get_rfc822_header( body, "Invitation-Command:", blen ); 714 char *cookie = get_rfc822_header( body, "Invitation-Cookie:", blen ); 715 715 unsigned int icookie; 716 716 … … 750 750 else if( g_strncasecmp( ct, "text/x-msmsgscontrol", 20 ) == 0 ) 751 751 { 752 char *who = msn_findheader( msg, "TypingUser:", msglen );752 char *who = get_rfc822_header( msg, "TypingUser:", msglen ); 753 753 754 754 if( who )
Note: See TracChangeset
for help on using the changeset viewer.