Mercurial > pidgin
comparison libpurple/protocols/bonjour/jabber.c @ 21465:e489c81e1f6f
Cleanup and fix the socks5 proxy connect address to be correct.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 13 Nov 2007 02:20:58 +0000 |
parents | 577d90f8794e |
children | 7a05b6f84545 |
comparison
equal
deleted
inserted
replaced
21464:577d90f8794e | 21465:e489c81e1f6f |
---|---|
877 xep_iq_new(void *data, XepIqType type, const gchar *to, const gchar *id) | 877 xep_iq_new(void *data, XepIqType type, const gchar *to, const gchar *id) |
878 { | 878 { |
879 xmlnode *iq_node = NULL; | 879 xmlnode *iq_node = NULL; |
880 XepIq *iq = NULL; | 880 XepIq *iq = NULL; |
881 | 881 |
882 if(data == NULL || to == NULL || id == NULL) | 882 g_return_val_if_fail(data != NULL, NULL); |
883 return NULL; | 883 g_return_val_if_fail(to != NULL, NULL); |
884 iq = g_new0(XepIq, 1); | 884 g_return_val_if_fail(id != NULL, NULL); |
885 if(iq == NULL) | |
886 return NULL; | |
887 | 885 |
888 iq_node = xmlnode_new("iq"); | 886 iq_node = xmlnode_new("iq"); |
889 if(iq_node == NULL) { | |
890 g_free(iq); | |
891 return NULL; | |
892 } | |
893 | 887 |
894 xmlnode_set_attrib(iq_node, "to", to); | 888 xmlnode_set_attrib(iq_node, "to", to); |
895 xmlnode_set_attrib(iq_node, "id", id); | 889 xmlnode_set_attrib(iq_node, "id", id); |
896 switch (type) { | 890 switch (type) { |
897 case XEP_IQ_SET: | 891 case XEP_IQ_SET: |
910 default: | 904 default: |
911 xmlnode_set_attrib(iq_node, "type", "none"); | 905 xmlnode_set_attrib(iq_node, "type", "none"); |
912 break; | 906 break; |
913 } | 907 } |
914 | 908 |
909 iq = g_new0(XepIq, 1); | |
915 iq->node = iq_node; | 910 iq->node = iq_node; |
916 iq->type = type; | 911 iq->type = type; |
917 iq->data = ((BonjourData*)data)->jabber_data; | 912 iq->data = ((BonjourData*)data)->jabber_data; |
918 iq->to = (char*)to; | 913 iq->to = (char*)to; |
919 return iq; | 914 return iq; |
962 else | 957 else |
963 xep_bytestreams_parse(connection, packet, pb); | 958 xep_bytestreams_parse(connection, packet, pb); |
964 } | 959 } |
965 | 960 |
966 int | 961 int |
967 xep_iq_send(XepIq *iq) | 962 xep_iq_send_and_free(XepIq *iq) |
968 { | 963 { |
969 int ret = -1; | 964 int ret = -1; |
970 PurpleBuddy *pb = NULL; | 965 PurpleBuddy *pb = NULL; |
971 | 966 |
972 /* start the talk, reuse the message socket */ | 967 /* start the talk, reuse the message socket */ |
976 /* Convert xml node into stream */ | 971 /* Convert xml node into stream */ |
977 gchar *msg = xmlnode_to_str(iq->node, NULL); | 972 gchar *msg = xmlnode_to_str(iq->node, NULL); |
978 ret = _send_data(pb, msg); | 973 ret = _send_data(pb, msg); |
979 g_free(msg); | 974 g_free(msg); |
980 } | 975 } |
976 | |
981 xmlnode_free(iq->node); | 977 xmlnode_free(iq->node); |
978 iq->node = NULL; | |
979 g_free(iq); | |
982 | 980 |
983 return (ret >= 0) ? 0 : -1; | 981 return (ret >= 0) ? 0 : -1; |
984 } | 982 } |
985 | 983 |
986 /* This returns a ';' delimited string containing all non-localhost IPs */ | 984 /* This returns a ';' delimited string containing all non-localhost IPs */ |
987 char * | 985 const char * |
988 purple_network_get_my_ip_ext2(int fd) | 986 purple_network_get_my_ip_ext2(int fd) |
989 { | 987 { |
990 char buffer[1024]; | 988 char buffer[1024]; |
991 static char ip_ext[17 * 10]; | 989 static char ip_ext[17 * 10]; |
992 char *tmp; | 990 char *tmp; |