You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
4.6 KiB
164 lines
4.6 KiB
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 groupChatSettqStatus(const QString &host, const QString &room, const tqStatus &);
|
|
void groupChatChangeNick(const QString &host, const QString &room, const QString &nick, const tqStatus &);
|
|
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").tqarg(jid.full()));
|
|
+ GroupChat i;
|
|
+ i.j = jid;
|
|
+ i.status = GroupChat::Connecting;
|
|
+ d->groupChatList += i;
|
|
+
|
|
+ JT_MucPresence *j = new JT_MucPresence(rootTask());
|
|
+ j->pres(jid, tqStatus(), password);
|
|
+ j->go(true);
|
|
+
|
|
+ return true;
|
|
+}
|
|
+
|
|
void Client::groupChatSettqStatus(const QString &host, const QString &room, const tqStatus &_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 tqStatus &);
|
|
+ void pres(const Jid &, const tqStatus &, 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 tqStatus &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").tqarg(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 tqStatus &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();
|
|
+}
|