diff options
Diffstat (limited to 'kopete/protocols/jabber/libiris/005_join_muc_with_password.patch')
-rw-r--r-- | kopete/protocols/jabber/libiris/005_join_muc_with_password.patch | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/kopete/protocols/jabber/libiris/005_join_muc_with_password.patch b/kopete/protocols/jabber/libiris/005_join_muc_with_password.patch new file mode 100644 index 00000000..058825db --- /dev/null +++ b/kopete/protocols/jabber/libiris/005_join_muc_with_password.patch @@ -0,0 +1,163 @@ +Index: iris/include/im.h +=================================================================== +--- iris/include/im.h (révision 498969) ++++ iris/include/im.h (copie de travail) +@@ -607,6 +607,7 @@ + FileTransferManager *fileTransferManager() const; + + bool groupChatJoin(const QString &host, const QString &room, const QString &nick); ++ bool groupChatJoin(const QString &host, const QString &room, const QString &nick, const QString &password); + void groupChatSetStatus(const QString &host, const QString &room, const Status &); + void groupChatChangeNick(const QString &host, const QString &room, const QString &nick, const Status &); + void groupChatLeave(const QString &host, const QString &room); +Index: iris/xmpp-im/client.cpp +=================================================================== +--- iris/xmpp-im/client.cpp (révision 498969) ++++ iris/xmpp-im/client.cpp (copie de travail) +@@ -315,6 +315,35 @@ + return true; + } + ++bool Client::groupChatJoin(const QString &host, const QString &room, const QString &nick, const QString &password) ++{ ++ Jid jid(room + "@" + host + "/" + nick); ++ for(QValueList<GroupChat>::Iterator it = d->groupChatList.begin(); it != d->groupChatList.end();) { ++ GroupChat &i = *it; ++ if(i.j.compare(jid, false)) { ++ // if this room is shutting down, then free it up ++ if(i.status == GroupChat::Closing) ++ it = d->groupChatList.remove(it); ++ else ++ return false; ++ } ++ else ++ ++it; ++ } ++ ++ debug(QString("Client: Joined: [%1]\n").arg(jid.full())); ++ GroupChat i; ++ i.j = jid; ++ i.status = GroupChat::Connecting; ++ d->groupChatList += i; ++ ++ JT_MucPresence *j = new JT_MucPresence(rootTask()); ++ j->pres(jid, Status(), password); ++ j->go(true); ++ ++ return true; ++} ++ + void Client::groupChatSetStatus(const QString &host, const QString &room, const Status &_s) + { + Jid jid(room + "@" + host); +Index: iris/xmpp-im/xmpp_tasks.h +=================================================================== +--- iris/xmpp-im/xmpp_tasks.h (révision 498969) ++++ iris/xmpp-im/xmpp_tasks.h (copie de travail) +@@ -439,6 +439,26 @@ + class Private; + Private *d; + }; ++ ++ class JT_MucPresence : public Task ++ { ++ Q_OBJECT ++ public: ++ JT_MucPresence(Task *parent); ++ ~JT_MucPresence(); ++ ++ void pres(const Status &); ++ void pres(const Jid &, const Status &, const QString &password); ++ ++ void onGo(); ++ ++ private: ++ QDomElement tag; ++ int type; ++ ++ class Private; ++ Private *d; ++ }; + } + + #endif +Index: iris/xmpp-im/xmpp_tasks.cpp +=================================================================== +--- iris/xmpp-im/xmpp_tasks.cpp (révision 498969) ++++ iris/xmpp-im/xmpp_tasks.cpp (copie de travail) +@@ -1956,3 +1956,75 @@ + return true; + } + ++//---------------------------------------------------------------------------- ++// JT_MucPresence ++//---------------------------------------------------------------------------- ++JT_MucPresence::JT_MucPresence(Task *parent) ++:Task(parent) ++{ ++ type = -1; ++} ++ ++JT_MucPresence::~JT_MucPresence() ++{ ++} ++ ++void JT_MucPresence::pres(const Status &s) ++{ ++ type = 0; ++ ++ tag = doc()->createElement("presence"); ++ if(!s.isAvailable()) { ++ tag.setAttribute("type", "unavailable"); ++ if(!s.status().isEmpty()) ++ tag.appendChild(textTag(doc(), "status", s.status())); ++ } ++ else { ++ if(s.isInvisible()) ++ tag.setAttribute("type", "invisible"); ++ ++ if(!s.show().isEmpty()) ++ tag.appendChild(textTag(doc(), "show", s.show())); ++ if(!s.status().isEmpty()) ++ tag.appendChild(textTag(doc(), "status", s.status())); ++ ++ tag.appendChild( textTag(doc(), "priority", QString("%1").arg(s.priority()) ) ); ++ ++ if(!s.keyID().isEmpty()) { ++ QDomElement x = textTag(doc(), "x", s.keyID()); ++ x.setAttribute("xmlns", "http://jabber.org/protocol/e2e"); ++ tag.appendChild(x); ++ } ++ if(!s.xsigned().isEmpty()) { ++ QDomElement x = textTag(doc(), "x", s.xsigned()); ++ x.setAttribute("xmlns", "jabber:x:signed"); ++ tag.appendChild(x); ++ } ++ ++ if(!s.capsNode().isEmpty() && !s.capsVersion().isEmpty()) { ++ QDomElement c = doc()->createElement("c"); ++ c.setAttribute("xmlns","http://jabber.org/protocol/caps"); ++ c.setAttribute("node",s.capsNode()); ++ c.setAttribute("ver",s.capsVersion()); ++ if (!s.capsExt().isEmpty()) ++ c.setAttribute("ext",s.capsExt()); ++ tag.appendChild(c); ++ } ++ } ++} ++ ++void JT_MucPresence::pres(const Jid &to, const Status &s, const QString &password) ++{ ++ pres(s); ++ tag.setAttribute("to", to.full()); ++ QDomElement x = textTag(doc(), "x", s.xsigned()); ++ x.setAttribute("xmlns", "http://jabber.org/protocol/muc"); ++ x.appendChild( textTag(doc(), "password", password.latin1()) ); ++ tag.appendChild(x); ++} ++ ++void JT_MucPresence::onGo() ++{ ++ send(tag); ++ setSuccess(); ++} |