Mercurial > pidgin
comparison libpurple/protocols/simple/simple.c @ 25947:4b8c4870b13a
propagate from branch 'im.pidgin.pidgin.next.minor' (head 7305b29db7bd00d3261f348c71674c93aa31b327)
to branch 'im.pidgin.pidgin' (head d8c03c68d591d9392607d954942ee58b8618d946)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 02 Mar 2009 04:18:40 +0000 |
parents | 68265bcc8814 ede59a571c0a |
children | ff4212a5268f |
comparison
equal
deleted
inserted
replaced
25946:8998ca47e6d0 | 25947:4b8c4870b13a |
---|---|
195 static void simple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) | 195 static void simple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
196 { | 196 { |
197 struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; | 197 struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; |
198 struct simple_buddy *b; | 198 struct simple_buddy *b; |
199 const char *name = purple_buddy_get_name(buddy); | 199 const char *name = purple_buddy_get_name(buddy); |
200 if(strcmp("sip:", name)) { | 200 if(strncmp(name, "sip:", 4)) { |
201 gchar *buf = g_strdup_printf("sip:%s", name); | 201 gchar *buf = g_strdup_printf("sip:%s", name); |
202 purple_blist_rename_buddy(buddy, buf); | 202 purple_blist_rename_buddy(buddy, buf); |
203 g_free(buf); | 203 g_free(buf); |
204 } | 204 } |
205 if(!g_hash_table_lookup(sip->buddies, name)) { | 205 if(!g_hash_table_lookup(sip->buddies, name)) { |
841 "Expires: %d\r\n" | 841 "Expires: %d\r\n" |
842 "Accept: application/pidf+xml, application/xpidf+xml\r\n" | 842 "Accept: application/pidf+xml, application/xpidf+xml\r\n" |
843 "Event: presence\r\n", | 843 "Event: presence\r\n", |
844 expiration); | 844 expiration); |
845 | 845 |
846 if(strstr(buddy->name, "sip:")) | 846 if(strncmp(buddy->name, "sip:", 4)) |
847 to = g_strdup_printf("sip:%s", buddy->name); | |
848 else | |
847 to = g_strdup(buddy->name); | 849 to = g_strdup(buddy->name); |
848 else | |
849 to = g_strdup_printf("sip:%s", buddy->name); | |
850 | 850 |
851 tmp = get_contact(sip); | 851 tmp = get_contact(sip); |
852 contact = g_strdup_printf("%sContact: %s\r\n", tmp2, tmp); | 852 contact = g_strdup_printf("%sContact: %s\r\n", tmp2, tmp); |
853 g_free(tmp); | 853 g_free(tmp); |
854 g_free(tmp2); | 854 g_free(tmp2); |
888 struct simple_buddy *bs; | 888 struct simple_buddy *bs; |
889 int len = msg->bodylen; | 889 int len = msg->bodylen; |
890 | 890 |
891 | 891 |
892 tmp = sipmsg_find_header(msg, "Event"); | 892 tmp = sipmsg_find_header(msg, "Event"); |
893 if(tmp && !strcmp(tmp, "vnd-microsoft-roaming-contacts")){ | 893 if(tmp && !strncmp(tmp, "vnd-microsoft-roaming-contacts", 30)){ |
894 | 894 |
895 purple_debug_info("simple", "simple_add_lcs_contacts->%s-%d\n", msg->body, len); | 895 purple_debug_info("simple", "simple_add_lcs_contacts->%s-%d\n", msg->body, len); |
896 /*Convert the contact from XML to Purple Buddies*/ | 896 /*Convert the contact from XML to Purple Buddies*/ |
897 isc = xmlnode_from_str(msg->body, len); | 897 isc = xmlnode_from_str(msg->body, len); |
898 | 898 |
1020 } | 1020 } |
1021 | 1021 |
1022 static void simple_send_message(struct simple_account_data *sip, const char *to, const char *msg, const char *type) { | 1022 static void simple_send_message(struct simple_account_data *sip, const char *to, const char *msg, const char *type) { |
1023 gchar *hdr; | 1023 gchar *hdr; |
1024 gchar *fullto; | 1024 gchar *fullto; |
1025 if(strcmp("sip:", to)) { | 1025 if(strncmp(to, "sip:", 4)) |
1026 fullto = g_strdup_printf("sip:%s", to); | 1026 fullto = g_strdup_printf("sip:%s", to); |
1027 } else { | 1027 else |
1028 fullto = g_strdup(to); | 1028 fullto = g_strdup(to); |
1029 } | 1029 |
1030 if(type) { | 1030 if(type) { |
1031 hdr = g_strdup_printf("Content-Type: %s\r\n", type); | 1031 hdr = g_strdup_printf("Content-Type: %s\r\n", type); |
1032 } else { | 1032 } else { |
1033 hdr = g_strdup("Content-Type: text/plain\r\n"); | 1033 hdr = g_strdup("Content-Type: text/plain\r\n"); |
1034 } | 1034 } |
1057 if(!from) return; | 1057 if(!from) return; |
1058 | 1058 |
1059 purple_debug(PURPLE_DEBUG_MISC, "simple", "got message from %s: %s\n", from, msg->body); | 1059 purple_debug(PURPLE_DEBUG_MISC, "simple", "got message from %s: %s\n", from, msg->body); |
1060 | 1060 |
1061 contenttype = sipmsg_find_header(msg, "Content-Type"); | 1061 contenttype = sipmsg_find_header(msg, "Content-Type"); |
1062 if(!contenttype || !strcmp(contenttype, "text/plain") || !strcmp(contenttype, "text/html")) { | 1062 if(!contenttype || !strncmp(contenttype, "text/plain", 10) || !strncmp(contenttype, "text/html", 9)) { |
1063 serv_got_im(sip->gc, from, msg->body, 0, time(NULL)); | 1063 serv_got_im(sip->gc, from, msg->body, 0, time(NULL)); |
1064 send_sip_response(sip->gc, msg, 200, "OK", NULL); | 1064 send_sip_response(sip->gc, msg, 200, "OK", NULL); |
1065 found = TRUE; | 1065 found = TRUE; |
1066 } | 1066 } |
1067 else if(!strcmp(contenttype, "application/im-iscomposing+xml")) { | 1067 else if(!strncmp(contenttype, "application/im-iscomposing+xml", 30)) { |
1068 xmlnode *isc = xmlnode_from_str(msg->body, msg->bodylen); | 1068 xmlnode *isc = xmlnode_from_str(msg->body, msg->bodylen); |
1069 xmlnode *state; | 1069 xmlnode *state; |
1070 gchar *statedata; | 1070 gchar *statedata; |
1071 | 1071 |
1072 if(!isc) { | 1072 if(!isc) { |