libpurple/protocols/jabber/parser.c

branch
next.minor
changeset 29665
ddf17c6b7fed
parent 29085
b2ddb2f7bfb9
child 29328
cf4435714f5f
equal deleted inserted replaced
29664:3df88daabac7 29665:ddf17c6b7fed
45 return; 45 return;
46 } else if(!xmlStrcmp(element_name, (xmlChar*) "stream")) { 46 } else if(!xmlStrcmp(element_name, (xmlChar*) "stream")) {
47 js->protocol_version = JABBER_PROTO_0_9; 47 js->protocol_version = JABBER_PROTO_0_9;
48 for(i=0; i < nb_attributes * 5; i += 5) { 48 for(i=0; i < nb_attributes * 5; i += 5) {
49 int attrib_len = attributes[i+4] - attributes[i+3]; 49 int attrib_len = attributes[i+4] - attributes[i+3];
50 char *attrib = g_malloc(attrib_len + 1); 50 char *attrib = g_strndup((gchar *)attributes[i+3], attrib_len);
51 memcpy(attrib, attributes[i+3], attrib_len);
52 attrib[attrib_len] = '\0';
53 51
54 if(!xmlStrcmp(attributes[i], (xmlChar*) "version") 52 if(!xmlStrcmp(attributes[i], (xmlChar*) "version")
55 && !strcmp(attrib, "1.0")) { 53 && !strcmp(attrib, "1.0")) {
56 js->protocol_version = JABBER_PROTO_1_0; 54 js->protocol_version = JABBER_PROTO_1_0;
57 g_free(attrib); 55 g_free(attrib);
86 const char *name = (const char *)attributes[i]; 84 const char *name = (const char *)attributes[i];
87 const char *prefix = (const char *)attributes[i+1]; 85 const char *prefix = (const char *)attributes[i+1];
88 const char *attrib_ns = (const char *)attributes[i+2]; 86 const char *attrib_ns = (const char *)attributes[i+2];
89 char *txt; 87 char *txt;
90 int attrib_len = attributes[i+4] - attributes[i+3]; 88 int attrib_len = attributes[i+4] - attributes[i+3];
91 char *attrib = g_malloc(attrib_len + 1); 89 char *attrib = g_strndup((gchar *)attributes[i+3], attrib_len);
92
93 memcpy(attrib, attributes[i+3], attrib_len);
94 attrib[attrib_len] = '\0';
95 90
96 txt = attrib; 91 txt = attrib;
97 attrib = purple_unescape_html(txt); 92 attrib = purple_unescape_html(txt);
98 g_free(txt); 93 g_free(txt);
99 xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); 94 xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib);
150 * This message happens when parsing vcards, and is normal, so don't 145 * This message happens when parsing vcards, and is normal, so don't
151 * bother logging it because people scare easily. 146 * bother logging it because people scare easily.
152 */ 147 */
153 return; 148 return;
154 149
155 if (error->level == XML_ERR_FATAL && error->message != NULL 150 if (error->level == XML_ERR_FATAL && error->code == XML_ERR_DOCUMENT_END)
156 && g_str_equal(error->message, "Extra content at the end of the document\n"))
157 /* 151 /*
158 * This is probably more annoying than the vcard-temp error; it occurs 152 * This is probably more annoying than the vcard-temp error; it occurs
159 * because we disconnect in most cases without waiting for the receiving 153 * because we disconnect in most cases without waiting for the receiving
160 * </stream:stream> (limitations of libpurple) 154 * </stream:stream> (limitations of libpurple)
161 */ 155 */
267 /* 261 /*
268 * Legacy servers don't advertise features, so if we've just gotten 262 * Legacy servers don't advertise features, so if we've just gotten
269 * the opening <stream:stream> and there was no version, we need to 263 * the opening <stream:stream> and there was no version, we need to
270 * immediately start legacy IQ auth. 264 * immediately start legacy IQ auth.
271 */ 265 */
272 js->auth_type = JABBER_AUTH_IQ_AUTH;
273 jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); 266 jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING);
274 } 267 jabber_auth_start_old(js);
275 } 268 }
276 269 }
270

mercurial