Mercurial > pidgin.yaz
comparison libpurple/protocols/simple/simple.c @ 25362:65cfc59858cf
propagate from branch 'im.pidgin.pidgin' (head d5bb29138cbe033bbfd8ec689203d73818765327)
to branch 'im.pidgin.pidgin.next.minor' (head 35ee8e40db640867e5b9239030cdc326e7f0a005)
author | Gary Kramlich <grim@reaperworld.com> |
---|---|
date | Sat, 13 Dec 2008 05:45:27 +0000 |
parents | 9bdd3ab8087f 222be065ce6e |
children | f8dbd57cf635 |
comparison
equal
deleted
inserted
replaced
25361:d9da15c9e2a1 | 25362:65cfc59858cf |
---|---|
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(strncmp("sip:", name, 4)) { | 200 if(strcmp("sip:", name)) { |
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)) { |
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 && !strncmp(tmp, "vnd-microsoft-roaming-contacts", 30)){ | 893 if(tmp && !strcmp(tmp, "vnd-microsoft-roaming-contacts")){ |
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(strncmp("sip:", to, 4)) { | 1025 if(strcmp("sip:", to)) { |
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) { |
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 || !strncmp(contenttype, "text/plain", 10) || !strncmp(contenttype, "text/html", 9)) { | 1062 if(!contenttype || !strcmp(contenttype, "text/plain") || !strcmp(contenttype, "text/html")) { |
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 if(!strncmp(contenttype, "application/im-iscomposing+xml", 30)) { | 1067 else if(!strcmp(contenttype, "application/im-iscomposing+xml")) { |
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) { |
1084 return; | 1084 return; |
1085 } | 1085 } |
1086 | 1086 |
1087 statedata = xmlnode_get_data(state); | 1087 statedata = xmlnode_get_data(state); |
1088 if(statedata) { | 1088 if(statedata) { |
1089 if(strstr(statedata, "active")) serv_got_typing(sip->gc, from, 0, PURPLE_TYPING); | 1089 if(strstr(statedata, "active")) |
1090 else serv_got_typing_stopped(sip->gc, from); | 1090 serv_got_typing(sip->gc, from, 0, PURPLE_TYPING); |
1091 else | |
1092 serv_got_typing_stopped(sip->gc, from); | |
1091 | 1093 |
1092 g_free(statedata); | 1094 g_free(statedata); |
1093 } | 1095 } |
1094 xmlnode_free(isc); | 1096 xmlnode_free(isc); |
1095 send_sip_response(sip->gc, msg, 200, "OK", NULL); | 1097 send_sip_response(sip->gc, msg, 200, "OK", NULL); |