comparison libpurple/protocols/jabber/chat.c @ 30909:25e200cb3532

propagate from branch 'im.pidgin.pidgin' (head dca20e09164518b0f7a773edd7e9649f41d8873d) to branch 'im.pidgin.cpw.malu.xmpp.google_refactor' (head 7823c556f2d1bbca43f5ef9f0fea30cabc5d313f)
author Marcus Lundblad <ml@update.uu.se>
date Tue, 31 Aug 2010 18:28:10 +0000
parents a0d6b85e9c42
children ba6a4a0f8f50
comparison
equal deleted inserted replaced
30908:c44ec533a48c 30909:25e200cb3532
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);