- Timestamp:
- 2010-08-18T19:21:44Z (14 years ago)
- Branches:
- master
- Children:
- f2520b5
- Parents:
- e0e1546
- Location:
- protocols/msn
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
re0e1546 r80175a1 83 83 struct msn_data *md = ic->proto_data; 84 84 GSList *l; 85 int i; 85 86 86 87 if( md ) … … 107 108 msn_msgq_purge( ic, &md->msgq ); 108 109 109 g_free( md->tokens[0] ); 110 g_free( md->tokens[1] ); 111 g_free( md->tokens[2] ); 110 for( i = 0; i < sizeof( md->tokens ) / sizeof( md->tokens[0] ); i ++ ) 111 g_free( md->tokens[i] ); 112 112 g_free( md->lock_key ); 113 113 … … 337 337 account_t *acc = set->data; 338 338 struct im_connection *ic = acc->ic; 339 struct msn_data *md = ic->proto_data; 339 340 340 341 if( strlen( value ) > 129 ) … … 343 344 return NULL; 344 345 } 346 347 if( md->flags & MSN_GOT_PROFILE_DN ) 348 imcb_log( ic, "Warning: Persistent name changes for this account have to be done " 349 "in the profile. BitlBee doesn't currently support this." ); 345 350 346 351 msn_soap_addressbook_set_display_name( ic, value ); -
protocols/msn/msn.h
re0e1546 r80175a1 50 50 51 51 #define MSNP11_PROD_KEY "ILTXC!4IXB5FB*PX" 52 //PK}_A_0N_K%O?A9S"53 52 #define MSNP11_PROD_ID "PROD0119GSJUC$18" 54 //PROD0114ES4Z%Q5W"55 53 #define MSNP_VER "MSNP15" 56 54 #define MSNP_BUILD "8.5.1288" 57 //"8.1.0178"58 55 59 56 #define MSN_SB_NEW -24062002 … … 76 73 #define PROFILE_URL "http://members.msn.com/" 77 74 75 typedef enum 76 { 77 MSN_GOT_PROFILE = 1, 78 MSN_GOT_PROFILE_DN = 2, 79 MSN_DONE_ADL = 4, 80 } msn_flags_t; 81 78 82 struct msn_data 79 83 { … … 82 86 int fd; 83 87 struct msn_handler_data *handler; 88 msn_flags_t flags; 84 89 85 90 int trId; 86 char *tokens[ 3];91 char *tokens[4]; 87 92 char *lock_key; 88 93 … … 206 211 void msn_auth_got_passport_token( struct im_connection *ic, const char *token, const char *error ); 207 212 void msn_auth_got_contact_list( struct im_connection *ic ); 213 int msn_ns_finish_login( struct im_connection *ic ); 208 214 209 215 /* msn_util.c */ -
protocols/msn/ns.c
re0e1546 r80175a1 259 259 { 260 260 msn_ns_send_adl_start( ic ); 261 262 if( md->adl_todo < 0 && !( ic->flags & OPT_LOGGED_IN ) ) 263 return msn_ns_set_display_name( ic, set_getstr( &ic->acc->set, "display_name" ) ); 261 return msn_ns_finish_login( ic ); 264 262 } 265 263 else if( strcmp( cmd[0], "ADL" ) == 0 ) … … 268 266 { 269 267 msn_ns_send_adl( ic ); 270 271 if( md->adl_todo < 0 && !( ic->flags & OPT_LOGGED_IN ) ) 272 { 273 msn_ns_send_adl( ic ); 274 275 if( md->adl_todo < 0 && !( ic->flags & OPT_LOGGED_IN ) ) 276 return msn_ns_set_display_name( ic, set_getstr( &ic->acc->set, "display_name" ) ); 277 } 268 return msn_ns_finish_login( ic ); 278 269 } 279 270 else if( num_parts >= 3 ) … … 818 809 msn_ns_send_adl( ic ); 819 810 } 811 812 int msn_ns_finish_login( struct im_connection *ic ) 813 { 814 struct msn_data *md = ic->proto_data; 815 816 if( ic->flags & OPT_LOGGED_IN ) 817 return 1; 818 819 if( md->adl_todo < 0 ) 820 md->flags |= MSN_DONE_ADL; 821 822 if( ( md->flags & MSN_DONE_ADL ) && ( md->flags & MSN_GOT_PROFILE ) ) 823 return msn_ns_set_display_name( ic, set_getstr( &ic->acc->set, "display_name" ) ); 824 else 825 return 1; 826 } -
protocols/msn/soap.c
re0e1546 r80175a1 209 209 210 210 *id -= '1'; 211 if( *id >= 0 && *id < = 2)211 if( *id >= 0 && *id < sizeof( md->tokens ) / sizeof( md->tokens[0] ) ) 212 212 { 213 213 g_free( md->tokens[(int)*id] ); … … 687 687 struct msn_soap_req_data *soap_req = data; 688 688 struct im_connection *ic = soap_req->ic; 689 struct msn_data *md = soap_req->ic->proto_data;690 689 struct msn_group *group; 691 690 … … 705 704 if( type && g_strcasecmp( type, "me" ) == 0 ) 706 705 { 707 #if 0708 g_free( md->myid );709 md->myid = g_strdup( id );710 #endif711 706 set_t *set = set_find( &ic->acc->set, "display_name" ); 712 707 g_free( set->value ); 713 708 set->value = g_strdup( display_name ); 709 710 /* Try to fetch the profile; if the user has one, that's where 711 we can find the persistent display_name. */ 712 if( ( p = xt_find_node( node->children, "CID" ) ) && p->text ) 713 msn_soap_profile_get( ic, p->text ); 714 714 715 715 return XT_HANDLED; … … 882 882 msn_soap_ab_contact_del_free_data ); 883 883 } 884 885 886 887 /* Storage stuff: Fetch profile. */ 888 static int msn_soap_profile_get_build_request( struct msn_soap_req_data *soap_req ) 889 { 890 struct msn_data *md = soap_req->ic->proto_data; 891 892 soap_req->url = g_strdup( SOAP_STORAGE_URL ); 893 soap_req->action = g_strdup( SOAP_PROFILE_GET_ACTION ); 894 soap_req->payload = g_markup_printf_escaped( SOAP_PROFILE_GET_PAYLOAD, 895 md->tokens[3], (char*) soap_req->data ); 896 897 return 1; 898 } 899 900 static xt_status msn_soap_profile_get_result( struct xt_node *node, gpointer data ) 901 { 902 struct msn_soap_req_data *soap_req = data; 903 struct im_connection *ic = soap_req->ic; 904 struct msn_data *md = soap_req->ic->proto_data; 905 struct xt_node *dn; 906 907 if( ( dn = xt_find_node( node->children, "DisplayName" ) ) && dn->text ) 908 { 909 set_t *set = set_find( &ic->acc->set, "display_name" ); 910 g_free( set->value ); 911 set->value = g_strdup( dn->text ); 912 913 md->flags |= MSN_GOT_PROFILE_DN; 914 } 915 916 return XT_HANDLED; 917 } 918 919 static const struct xt_handler_entry msn_soap_profile_get_parser[] = { 920 { "ExpressionProfile", "GetProfileResult", msn_soap_profile_get_result }, 921 { NULL, NULL, NULL } 922 }; 923 924 static int msn_soap_profile_get_handle_response( struct msn_soap_req_data *soap_req ) 925 { 926 struct msn_data *md = soap_req->ic->proto_data; 927 928 md->flags |= MSN_GOT_PROFILE; 929 msn_ns_finish_login( soap_req->ic ); 930 931 return MSN_SOAP_OK; 932 } 933 934 static int msn_soap_profile_get_free_data( struct msn_soap_req_data *soap_req ) 935 { 936 g_free( soap_req->data ); 937 return 0; 938 } 939 940 int msn_soap_profile_get( struct im_connection *ic, const char *cid ) 941 { 942 return msn_soap_start( ic, g_strdup( cid ), 943 msn_soap_profile_get_build_request, 944 msn_soap_profile_get_parser, 945 msn_soap_profile_get_handle_response, 946 msn_soap_profile_get_free_data ); 947 } -
protocols/msn/soap.h
re0e1546 r80175a1 126 126 "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI_SSL\"></wsse:PolicyReference>" \ 127 127 "</wst:RequestSecurityToken>" \ 128 "<wst:RequestSecurityToken Id=\"RST3\">" \ 129 "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \ 130 "<wsp:AppliesTo>" \ 131 "<wsa:EndpointReference>" \ 132 "<wsa:Address>storage.msn.com</wsa:Address>" \ 133 "</wsa:EndpointReference>" \ 134 "</wsp:AppliesTo>" \ 135 "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI_SSL\"></wsse:PolicyReference>" \ 136 "</wst:RequestSecurityToken>" \ 128 137 "</ps:RequestMultipleSecurityTokens>" \ 129 138 "</Body>" \ … … 287 296 int msn_soap_ab_contact_del( struct im_connection *ic, bee_user_t *bu ); 288 297 298 299 #define SOAP_STORAGE_URL "https://storage.msn.com/storageservice/SchematizedStore.asmx" 300 #define SOAP_PROFILE_GET_ACTION "http://www.msn.com/webservices/storage/w10/GetProfile" 301 302 #define SOAP_PROFILE_GET_PAYLOAD \ 303 "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \ 304 "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \ 305 "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \ 306 "<StorageApplicationHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \ 307 "<ApplicationID>Messenger Client 9.0</ApplicationID>" \ 308 "<Scenario>Initial</Scenario>" \ 309 "</StorageApplicationHeader>" \ 310 "<StorageUserHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \ 311 "<Puid>0</Puid>" \ 312 "<TicketToken>%s</TicketToken>" \ 313 "</StorageUserHeader>" \ 314 "</soap:Header>" \ 315 "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \ 316 "<GetProfile xmlns=\"http://www.msn.com/webservices/storage/w10\">" \ 317 "<profileHandle>" \ 318 "<Alias>" \ 319 "<Name>%s</Name>" \ 320 "<NameSpace>MyCidStuff</NameSpace>" \ 321 "</Alias>" \ 322 "<RelationshipName>MyProfile</RelationshipName>" \ 323 "</profileHandle>" \ 324 "<profileAttributes>" \ 325 "<ResourceID>true</ResourceID>" \ 326 "<DateModified>true</DateModified>" \ 327 "<ExpressionProfileAttributes>" \ 328 "<ResourceID>true</ResourceID>" \ 329 "<DateModified>true</DateModified>" \ 330 "<DisplayName>true</DisplayName>" \ 331 "<DisplayNameLastModified>true</DisplayNameLastModified>" \ 332 "<PersonalStatus>true</PersonalStatus>" \ 333 "<PersonalStatusLastModified>true</PersonalStatusLastModified>" \ 334 "<StaticUserTilePublicURL>true</StaticUserTilePublicURL>" \ 335 "<Photo>true</Photo>" \ 336 "<Flags>true</Flags>" \ 337 "</ExpressionProfileAttributes>" \ 338 "</profileAttributes>" \ 339 "</GetProfile>" \ 340 "</soap:Body>" \ 341 "</soap:Envelope>" 342 343 int msn_soap_profile_get( struct im_connection *ic, const char *cid ); 344 345 289 346 #endif /* __SOAP_H__ */
Note: See TracChangeset
for help on using the changeset viewer.