Mercurial > pidgin.yaz
changeset 7895:ddd80ffd3815
[gaim-migrate @ 8555]
wanted to get this committed before I went home
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 19 Dec 2003 08:33:03 +0000 |
parents | 8a9f0754f0be |
children | 4294afe670ad |
files | src/protocols/jabber/chat.c src/protocols/jabber/chat.h src/protocols/jabber/presence.c |
diffstat | 3 files changed, 48 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/jabber/chat.c Fri Dec 19 08:31:06 2003 +0000 +++ b/src/protocols/jabber/chat.c Fri Dec 19 08:33:03 2003 +0000 @@ -24,6 +24,7 @@ #include "notify.h" #include "chat.h" +#include "iq.h" #include "message.h" #include "presence.h" @@ -264,3 +265,36 @@ return g_strdup_printf("%s@%s/%s", chat->room, chat->server, who); } + +void jabber_chat_start_room_configure(JabberChat *chat) { + if(!chat) + return; + + /* XXX: implement me! */ + + /* XXX: for now... */ + jabber_chat_create_instant_room(chat); +} + +void jabber_chat_create_instant_room(JabberChat *chat) { + JabberIq *iq; + xmlnode *query, *x; + char *room_jid; + + if(!chat) + return; + + iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, + "http://jabber.org/protocol/muc#owner"); + query = xmlnode_get_child(iq->node, "query"); + x = xmlnode_new_child(query, "x"); + room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); + + xmlnode_set_attrib(iq->node, "to", room_jid); + xmlnode_set_attrib(x, "xmlns", "jabber:x:data"); + xmlnode_set_attrib(x, "type", "submit"); + + jabber_iq_send(iq); + + g_free(room_jid); +}
--- a/src/protocols/jabber/chat.h Fri Dec 19 08:31:06 2003 +0000 +++ b/src/protocols/jabber/chat.h Fri Dec 19 08:33:03 2003 +0000 @@ -51,6 +51,8 @@ const char *name); void jabber_chat_leave(GaimConnection *gc, int id); char *jabber_chat_buddy_real_name(GaimConnection *gc, int id, const char *who); +void jabber_chat_start_room_configure(JabberChat *chat); +void jabber_chat_create_instant_room(JabberChat *chat); #endif /* _GAIM_JABBER_CHAT_H_ */
--- a/src/protocols/jabber/presence.c Fri Dec 19 08:31:06 2003 +0000 +++ b/src/protocols/jabber/presence.c Fri Dec 19 08:33:03 2003 +0000 @@ -239,22 +239,18 @@ if((z = xmlnode_get_child(y, "status"))) { const char *code = xmlnode_get_attrib(z, "code"); if(code && !strcmp(code, "201")) { - /* we created the room. for now, we'll make it - * an instant room. XXX: allow fancy room creation */ - JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#owner"); - xmlnode *query = xmlnode_get_child(iq->node, "query"); - xmlnode *x = xmlnode_new_child(query, "x"); - char *room_jid = g_strdup_printf("%s@%s", jid->node, - jid->domain); - - xmlnode_set_attrib(iq->node, "to", room_jid); - xmlnode_set_attrib(x, "xmlns", "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); - - jabber_iq_send(iq); - - g_free(room_jid); + chat = jabber_chat_find(js, jid->node, jid->domain); + /* XXX: finish this + gaim_request_action(js->gc, _("Create New Room"), + _("Create New Room"), + _("You are creating a new room. Would you like to " + "configure it, or accept the default settings?"), + 1, chat, 2, _("Configure Room"), + G_CALLBACK(jabber_chat_start_room_configure), + _("Accept Defaults"), + G_CALLBACK(jabber_chat_create_instant_room)); + */ + jabber_chat_create_instant_room(chat); } } }