Mercurial > pidgin
comparison libpurple/protocols/jabber/chat.c @ 30314:a0d6b85e9c42
jabber: Avoid an assertion warning
As noticed by Elliott
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 31 Jul 2010 20:18:59 +0000 |
parents | c8b407fec879 |
children | ba6a4a0f8f50 |
comparison
equal
deleted
inserted
replaced
30313:30f16cb2f736 | 30314:a0d6b85e9c42 |
---|---|
171 xmlnode_set_attrib(message, "to", room_jid); | 171 xmlnode_set_attrib(message, "to", room_jid); |
172 x = xmlnode_new_child(message, "x"); | 172 x = xmlnode_new_child(message, "x"); |
173 xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user"); | 173 xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user"); |
174 invite = xmlnode_new_child(x, "invite"); | 174 invite = xmlnode_new_child(x, "invite"); |
175 xmlnode_set_attrib(invite, "to", name); | 175 xmlnode_set_attrib(invite, "to", name); |
176 body = xmlnode_new_child(invite, "reason"); | 176 if (msg) { |
177 xmlnode_insert_data(body, msg, -1); | 177 body = xmlnode_new_child(invite, "reason"); |
178 xmlnode_insert_data(body, msg, -1); | |
179 } | |
178 } else { | 180 } else { |
179 xmlnode_set_attrib(message, "to", name); | 181 xmlnode_set_attrib(message, "to", name); |
180 /* | 182 /* |
181 * Putting the reason into the body was an 'undocumented protocol, | 183 * Putting the reason into the body was an 'undocumented protocol, |
182 * ...not part of "groupchat 1.0"'. | 184 * ...not part of "groupchat 1.0"'. |
183 * http://xmpp.org/extensions/attic/jep-0045-1.16.html#invite | 185 * http://xmpp.org/extensions/attic/jep-0045-1.16.html#invite |
184 * | 186 * |
185 * Left here for compatibility. | 187 * Left here for compatibility. |
186 */ | 188 */ |
187 body = xmlnode_new_child(message, "body"); | 189 if (msg) { |
188 xmlnode_insert_data(body, msg, -1); | 190 body = xmlnode_new_child(message, "body"); |
191 xmlnode_insert_data(body, msg, -1); | |
192 } | |
189 | 193 |
190 x = xmlnode_new_child(message, "x"); | 194 x = xmlnode_new_child(message, "x"); |
191 xmlnode_set_attrib(x, "jid", room_jid); | 195 xmlnode_set_attrib(x, "jid", room_jid); |
192 | 196 |
193 /* The better place for it! XEP-0249 style. */ | 197 /* The better place for it! XEP-0249 style. */ |
194 xmlnode_set_attrib(x, "reason", msg); | 198 if (msg) |
199 xmlnode_set_attrib(x, "reason", msg); | |
195 xmlnode_set_namespace(x, "jabber:x:conference"); | 200 xmlnode_set_namespace(x, "jabber:x:conference"); |
196 } | 201 } |
197 | 202 |
198 jabber_send(js, message); | 203 jabber_send(js, message); |
199 xmlnode_free(message); | 204 xmlnode_free(message); |