Changeset 80175a1 for protocols/msn/soap.c
- Timestamp:
- 2010-08-18T19:21:44Z (14 years ago)
- Branches:
- master
- Children:
- f2520b5
- Parents:
- e0e1546
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.