Changeset 5f40da7 for protocols/msn/msn_util.c
- Timestamp:
- 2011-12-26T10:51:19Z (13 years ago)
- Branches:
- master
- Children:
- 199fea6
- Parents:
- 96f954d (diff), 644b808 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn_util.c
r96f954d r5f40da7 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
Note: See TracChangeset
for help on using the changeset viewer.