Changeset 06aed9a for protocols/msn/msn.c
- Timestamp:
- 2012-10-01T22:51:39Z (12 years ago)
- Branches:
- master
- Children:
- 4fdb102
- Parents:
- a992d7a (diff), 4c9d377 (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.c
ra992d7a r06aed9a 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-201 0Wilmer van der Gaast and others *4 * Copyright 2002-2012 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 98 98 g_free( md->lock_key ); 99 99 g_free( md->pp_policy ); 100 g_free( md->uuid ); 100 101 101 102 while( md->groups ) … … 139 140 static int msn_buddy_msg( struct im_connection *ic, char *who, char *message, int away ) 140 141 { 142 struct bee_user *bu = bee_user_by_handle( ic->bee, ic, who ); 143 struct msn_buddy_data *bd = bu ? bu->data : NULL; 141 144 struct msn_switchboard *sb; 142 145 … … 148 151 else 149 152 #endif 150 if( ( sb = msn_sb_by_handle( ic, who ) ) ) 153 if( bd && bd->flags & MSN_BUDDY_FED ) 154 { 155 msn_ns_sendmessage( ic, bu, message ); 156 } 157 else if( ( sb = msn_sb_by_handle( ic, who ) ) ) 151 158 { 152 159 return( msn_sb_sendmessage( sb, message ) ); … … 190 197 md->away_state = msn_away_state_list + 1; 191 198 192 if( !msn_ns_write( ic, -1, "CHG %d %s \r\n", ++md->trId, md->away_state->code) )199 if( !msn_ns_write( ic, -1, "CHG %d %s %d:%02d\r\n", ++md->trId, md->away_state->code, MSN_CAP1, MSN_CAP2 ) ) 193 200 return; 194 201 195 uux = g_markup_printf_escaped( "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia>" 196 "</Data>", message ? message : "" ); 202 uux = g_markup_printf_escaped( "<EndpointData><Capabilities>%d:%02d" 203 "</Capabilities></EndpointData>", 204 MSN_CAP1, MSN_CAP2 ); 205 msn_ns_write( ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux ); 206 g_free( uux ); 207 208 uux = g_markup_printf_escaped( "<PrivateEndpointData><EpName>%s</EpName>" 209 "<Idle>%s</Idle><ClientType>%d</ClientType>" 210 "<State>%s</State></PrivateEndpointData>", 211 md->uuid, 212 strcmp( md->away_state->code, "IDL" ) ? "false" : "true", 213 1, /* ? */ 214 md->away_state->code ); 215 msn_ns_write( ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux ); 216 g_free( uux ); 217 218 uux = g_markup_printf_escaped( "<Data><DDP></DDP><PSM>%s</PSM>" 219 "<CurrentMedia></CurrentMedia>" 220 "<MachineGuid>%s</MachineGuid></Data>", 221 message ? message : "", md->uuid ); 197 222 msn_ns_write( ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux ); 198 223 g_free( uux ); … … 232 257 { 233 258 struct msn_switchboard *sb = msn_sb_by_chat( c ); 234 char buf[1024];235 259 236 260 if( sb ) 237 { 238 g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who ); 239 msn_sb_write( sb, buf, strlen( buf ) ); 240 } 261 msn_sb_write( sb, "CAL %d %s\r\n", ++sb->trId, who ); 241 262 } 242 263 … … 246 267 247 268 if( sb ) 248 msn_sb_write( sb, "OUT\r\n" , 5);269 msn_sb_write( sb, "OUT\r\n" ); 249 270 } 250 271 … … 340 361 { 341 362 struct msn_data *md = bu->ic->proto_data; 342 bu->data = g_new0( struct msn_buddy_data, 1 ); 363 struct msn_buddy_data *bd; 364 char *handle; 365 366 bd = bu->data = g_new0( struct msn_buddy_data, 1 ); 343 367 g_tree_insert( md->domaintree, bu->handle, bu ); 368 369 for( handle = bu->handle; isdigit( *handle ); handle ++ ); 370 if( *handle == ':' ) 371 { 372 /* Pass a nick hint so hopefully the stupid numeric prefix 373 won't show up to the user. */ 374 char *s = strchr( ++handle, '@' ); 375 if( s ) 376 { 377 handle = g_strndup( handle, s - handle ); 378 imcb_buddy_nick_hint( bu->ic, bu->handle, handle ); 379 g_free( handle ); 380 } 381 382 bd->flags |= MSN_BUDDY_FED; 383 } 344 384 } 345 385
Note: See TracChangeset
for help on using the changeset viewer.