summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 00:30:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-22 00:30:31 +0000
commit69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch)
tree073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
parent3467e6464beac3a162839bf7078e22e3a74d73e7 (diff)
downloadtdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz
tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp')
-rw-r--r--kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
index c78875bc..9d56467c 100644
--- a/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
+++ b/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp
@@ -34,8 +34,8 @@
//! Client, you will need to manually invoke Tasks. Fortunately, the
//! process is very simple.
//!
-//! The entire Task system is heavily founded on Qt. All Tasks have a parent,
-//! except for the root Task, and are considered QObjects. By using Qt's RTTI
+//! The entire Task system is heavily founded on TQt. All Tasks have a tqparent,
+//! except for the root Task, and are considered TQObjects. By using TQt's RTTI
//! facilities (TQObject::sender(), TQObject::isA(), etc), you can use a
//! "fire and forget" approach with Tasks.
//!
@@ -96,7 +96,7 @@
using namespace Jabber;*/
-#ifdef Q_WS_WIN
+#ifdef TQ_WS_WIN
#define vsnprintf _vsnprintf
#endif
@@ -191,7 +191,7 @@ void Client::connectToServer(ClientStream *s, const Jid &j, bool auth)
//connect(d->stream, TQT_SIGNAL(connected()), TQT_SLOT(streamConnected()));
//connect(d->stream, TQT_SIGNAL(handshaken()), TQT_SLOT(streamHandshaken()));
connect(d->stream, TQT_SIGNAL(error(int)), TQT_SLOT(streamError(int)));
- //connect(d->stream, TQT_SIGNAL(sslCertificateReady(const QSSLCert &)), TQT_SLOT(streamSSLCertificateReady(const QSSLCert &)));
+ //connect(d->stream, TQT_SIGNAL(sslCertificateReady(const TQSSLCert &)), TQT_SLOT(streamSSLCertificateReady(const TQSSLCert &)));
connect(d->stream, TQT_SIGNAL(readyRead()), TQT_SLOT(streamReadyRead()));
//connect(d->stream, TQT_SIGNAL(closeFinished()), TQT_SLOT(streamCloseFinished()));
connect(d->stream, TQT_SIGNAL(incomingXml(const TQString &)), TQT_SLOT(streamIncomingXml(const TQString &)));
@@ -208,13 +208,13 @@ void Client::start(const TQString &host, const TQString &user, const TQString &p
d->pass = pass;
d->resource = _resource;
- Status stat;
+ tqStatus stat;
stat.setIsAvailable(false);
d->resourceList += Resource(resource(), stat);
JT_PushPresence *pp = new JT_PushPresence(rootTask());
connect(pp, TQT_SIGNAL(subscription(const Jid &, const TQString &)), TQT_SLOT(ppSubscription(const Jid &, const TQString &)));
- connect(pp, TQT_SIGNAL(presence(const Jid &, const Status &)), TQT_SLOT(ppPresence(const Jid &, const Status &)));
+ connect(pp, TQT_SIGNAL(presence(const Jid &, const tqStatus &)), TQT_SLOT(ppPresence(const Jid &, const tqStatus &)));
JT_PushMessage *pm = new JT_PushMessage(rootTask());
connect(pm, TQT_SIGNAL(message(const Message &)), TQT_SLOT(pmMessage(const Message &)));
@@ -266,7 +266,7 @@ bool Client::isActive() const
return d->active;
}
-void Client::groupChatChangeNick(const TQString &host, const TQString &room, const TQString &nick, const Status &_s)
+void Client::groupChatChangeNick(const TQString &host, const TQString &room, const TQString &nick, const tqStatus &_s)
{
Jid jid(room + "@" + host + "/" + nick);
for(TQValueList<GroupChat>::Iterator it = d->groupChatList.begin(); it != d->groupChatList.end(); it++) {
@@ -274,7 +274,7 @@ void Client::groupChatChangeNick(const TQString &host, const TQString &room, con
if(i.j.compare(jid, false)) {
i.j = jid;
- Status s = _s;
+ tqStatus s = _s;
s.setIsAvailable(true);
JT_Presence *j = new JT_Presence(rootTask());
@@ -302,14 +302,14 @@ bool Client::groupChatJoin(const TQString &host, const TQString &room, const TQS
++it;
}
- debug(TQString("Client: Joined: [%1]\n").arg(jid.full()));
+ debug(TQString("Client: Joined: [%1]\n").tqarg(jid.full()));
GroupChat i;
i.j = jid;
i.status = GroupChat::Connecting;
d->groupChatList += i;
JT_Presence *j = new JT_Presence(rootTask());
- j->pres(jid, Status());
+ j->pres(jid, tqStatus());
j->go(true);
return true;
@@ -331,20 +331,20 @@ bool Client::groupChatJoin(const TQString &host, const TQString &room, const TQS
++it;
}
- debug(TQString("Client: Joined: [%1]\n").arg(jid.full()));
+ debug(TQString("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, Status(), password);
+ j->pres(jid, tqStatus(), password);
j->go(true);
return true;
}
-void Client::groupChatSetStatus(const TQString &host, const TQString &room, const Status &_s)
+void Client::groupChatSettqStatus(const TQString &host, const TQString &room, const tqStatus &_s)
{
Jid jid(room + "@" + host);
bool found = false;
@@ -359,7 +359,7 @@ void Client::groupChatSetStatus(const TQString &host, const TQString &room, cons
if(!found)
return;
- Status s = _s;
+ tqStatus s = _s;
s.setIsAvailable(true);
JT_Presence *j = new JT_Presence(rootTask());
@@ -377,10 +377,10 @@ void Client::groupChatLeave(const TQString &host, const TQString &room)
continue;
i.status = GroupChat::Closing;
- debug(TQString("Client: Leaving: [%1]\n").arg(i.j.full()));
+ debug(TQString("Client: Leaving: [%1]\n").tqarg(i.j.full()));
JT_Presence *j = new JT_Presence(rootTask());
- Status s;
+ tqStatus s;
s.setIsAvailable(false);
j->pres(i.j, s);
j->go(true);
@@ -409,7 +409,7 @@ void Client::close(bool)
i.status = GroupChat::Closing;
JT_Presence *j = new JT_Presence(rootTask());
- Status s;
+ tqStatus s;
s.setIsAvailable(false);
j->pres(i.j, s);
j->go(true);
@@ -457,7 +457,7 @@ void Client::streamError(int)
//}
}
-/*void Client::streamSSLCertificateReady(const QSSLCert &cert)
+/*void Client::streamSSLCertificateReady(const TQSSLCert &cert)
{
sslCertReady(cert);
}
@@ -469,10 +469,10 @@ void Client::streamCloseFinished()
static TQDomElement oldStyleNS(const TQDomElement &e)
{
- // find closest parent with a namespace
- TQDomNode par = e.parentNode();
+ // find closest tqparent with a namespace
+ TQDomNode par = e.tqparentNode();
while(!par.isNull() && par.namespaceURI().isNull())
- par = par.parentNode();
+ par = par.tqparentNode();
bool noShowNS = false;
if(!par.isNull() && par.namespaceURI() == e.namespaceURI())
noShowNS = true;
@@ -492,7 +492,7 @@ static TQDomElement oldStyleNS(const TQDomElement &e)
if(!noShowNS)
i.setAttribute("xmlns", e.namespaceURI());
- // copy children
+ // copy tqchildren
TQDomNodeList nl = e.childNodes();
for(x = 0; x < nl.count(); ++x) {
TQDomNode n = nl.item(x);
@@ -513,7 +513,7 @@ void Client::streamReadyRead()
Stanza s = d->stream->read();
TQString out = s.toString();
- debug(TQString("Client: incoming: [\n%1]\n").arg(out));
+ debug(TQString("Client: incoming: [\n%1]\n").tqarg(out));
xmlIncoming(out);
TQDomElement x = oldStyleNS(s.element());
@@ -588,7 +588,7 @@ static TQDomElement addCorrectNS(const TQDomElement &e)
// find closest xmlns
TQDomNode n = e;
while(!n.isNull() && !n.toElement().hasAttribute("xmlns"))
- n = n.parentNode();
+ n = n.tqparentNode();
TQString ns;
if(n.isNull() || !n.toElement().hasAttribute("xmlns"))
ns = "jabber:client";
@@ -606,7 +606,7 @@ static TQDomElement addCorrectNS(const TQDomElement &e)
i.setAttributeNodeNS(a.cloneNode().toAttr());
}
- // copy children
+ // copy tqchildren
TQDomNodeList nl = e.childNodes();
for(x = 0; x < nl.count(); ++x) {
TQDomNode n = nl.item(x);
@@ -630,7 +630,7 @@ void Client::send(const TQDomElement &x)
//x.save(ts, 0);
//TQString out = Stream::xmlToString(x);
- //debug(TQString("Client: outgoing: [\n%1]\n").arg(out));
+ //debug(TQString("Client: outgoing: [\n%1]\n").tqarg(out));
//xmlOutgoing(out);
TQDomElement e = addCorrectNS(x);
@@ -641,7 +641,7 @@ void Client::send(const TQDomElement &x)
}
TQString out = s.toString();
- debug(TQString("Client: outgoing: [\n%1]\n").arg(out));
+ debug(TQString("Client: outgoing: [\n%1]\n").tqarg(out));
xmlOutgoing(out);
//printf("x[%s] x2[%s] s[%s]\n", Stream::xmlToString(x).latin1(), Stream::xmlToString(e).latin1(), s.toString().latin1());
@@ -653,7 +653,7 @@ void Client::send(const TQString &str)
if(!d->stream)
return;
- debug(TQString("Client: outgoing: [\n%1]\n").arg(str));
+ debug(TQString("Client: outgoing: [\n%1]\n").tqarg(str));
xmlOutgoing(str);
static_cast<ClientStream*>(d->stream)->writeDirect(str);
}
@@ -712,12 +712,12 @@ void Client::ppSubscription(const Jid &j, const TQString &s)
subscription(j, s);
}
-void Client::ppPresence(const Jid &j, const Status &s)
+void Client::ppPresence(const Jid &j, const tqStatus &s)
{
if(s.isAvailable())
- debug(TQString("Client: %1 is available.\n").arg(j.full()));
+ debug(TQString("Client: %1 is available.\n").tqarg(j.full()));
else
- debug(TQString("Client: %1 is unavailable.\n").arg(j.full()));
+ debug(TQString("Client: %1 is unavailable.\n").tqarg(j.full()));
for(TQValueList<GroupChat>::Iterator it = d->groupChatList.begin(); it != d->groupChatList.end(); it++) {
GroupChat &i = *it;
@@ -725,7 +725,7 @@ void Client::ppPresence(const Jid &j, const Status &s)
if(i.j.compare(j, false)) {
bool us = (i.j.resource() == j.resource() || j.resource().isEmpty()) ? true: false;
- debug(TQString("for groupchat i=[%1] pres=[%2], [us=%3].\n").arg(i.j.full()).arg(j.full()).arg(us));
+ debug(TQString("for groupchat i=[%1] pres=[%2], [us=%3].\n").tqarg(i.j.full()).tqarg(j.full()).tqarg(us));
switch(i.status) {
case GroupChat::Connecting:
if(us && s.hasError()) {
@@ -788,16 +788,16 @@ void Client::ppPresence(const Jid &j, const Status &s)
}
}
-void Client::updateSelfPresence(const Jid &j, const Status &s)
+void Client::updateSelfPresence(const Jid &j, const tqStatus &s)
{
- ResourceList::Iterator rit = d->resourceList.find(j.resource());
+ ResourceList::Iterator rit = d->resourceList.tqfind(j.resource());
bool found = (rit == d->resourceList.end()) ? false: true;
// unavailable? remove the resource
if(!s.isAvailable()) {
if(found) {
- debug(TQString("Client: Removing self resource: name=[%1]\n").arg(j.resource()));
- (*rit).setStatus(s);
+ debug(TQString("Client: Removing self resource: name=[%1]\n").tqarg(j.resource()));
+ (*rit).settqStatus(s);
resourceUnavailable(j, *rit);
d->resourceList.remove(rit);
}
@@ -808,31 +808,31 @@ void Client::updateSelfPresence(const Jid &j, const Status &s)
if(!found) {
r = Resource(j.resource(), s);
d->resourceList += r;
- debug(TQString("Client: Adding self resource: name=[%1]\n").arg(j.resource()));
+ debug(TQString("Client: Adding self resource: name=[%1]\n").tqarg(j.resource()));
}
else {
- (*rit).setStatus(s);
+ (*rit).settqStatus(s);
r = *rit;
- debug(TQString("Client: Updating self resource: name=[%1]\n").arg(j.resource()));
+ debug(TQString("Client: Updating self resource: name=[%1]\n").tqarg(j.resource()));
}
resourceAvailable(j, r);
}
}
-void Client::updatePresence(LiveRosterItem *i, const Jid &j, const Status &s)
+void Client::updatePresence(LiveRosterItem *i, const Jid &j, const tqStatus &s)
{
- ResourceList::Iterator rit = i->resourceList().find(j.resource());
+ ResourceList::Iterator rit = i->resourceList().tqfind(j.resource());
bool found = (rit == i->resourceList().end()) ? false: true;
// unavailable? remove the resource
if(!s.isAvailable()) {
if(found) {
- (*rit).setStatus(s);
- debug(TQString("Client: Removing resource from [%1]: name=[%2]\n").arg(i->jid().full()).arg(j.resource()));
+ (*rit).settqStatus(s);
+ debug(TQString("Client: Removing resource from [%1]: name=[%2]\n").tqarg(i->jid().full()).tqarg(j.resource()));
resourceUnavailable(j, *rit);
i->resourceList().remove(rit);
- i->setLastUnavailableStatus(s);
+ i->setLastUnavailabletqStatus(s);
}
}
// available? add/update the resource
@@ -841,12 +841,12 @@ void Client::updatePresence(LiveRosterItem *i, const Jid &j, const Status &s)
if(!found) {
r = Resource(j.resource(), s);
i->resourceList() += r;
- debug(TQString("Client: Adding resource to [%1]: name=[%2]\n").arg(i->jid().full()).arg(j.resource()));
+ debug(TQString("Client: Adding resource to [%1]: name=[%2]\n").tqarg(i->jid().full()).tqarg(j.resource()));
}
else {
- (*rit).setStatus(s);
+ (*rit).settqStatus(s);
r = *rit;
- debug(TQString("Client: Updating resource to [%1]: name=[%2]\n").arg(i->jid().full()).arg(j.resource()));
+ debug(TQString("Client: Updating resource to [%1]: name=[%2]\n").tqarg(i->jid().full()).tqarg(j.resource()));
}
resourceAvailable(j, r);
@@ -855,7 +855,7 @@ void Client::updatePresence(LiveRosterItem *i, const Jid &j, const Status &s)
void Client::pmMessage(const Message &m)
{
- debug(TQString("Client: Message from %1\n").arg(m.from().full()));
+ debug(TQString("Client: Message from %1\n").tqarg(m.from().full()));
if(m.type() == "groupchat") {
for(TQValueList<GroupChat>::Iterator it = d->groupChatList.begin(); it != d->groupChatList.end(); it++) {
@@ -950,7 +950,7 @@ void Client::importRosterItem(const RosterItem &item)
// Remove
if(item.subscription().type() == Subscription::Remove) {
- LiveRoster::Iterator it = d->roster.find(item.jid());
+ LiveRoster::Iterator it = d->roster.tqfind(item.jid());
if(it != d->roster.end()) {
rosterItemRemoved(*it);
d->roster.remove(it);
@@ -959,7 +959,7 @@ void Client::importRosterItem(const RosterItem &item)
}
// Add/Update
else {
- LiveRoster::Iterator it = d->roster.find(item.jid());
+ LiveRoster::Iterator it = d->roster.tqfind(item.jid());
if(it != d->roster.end()) {
LiveRosterItem &i = *it;
i.setFlagForDelete(false);
@@ -993,7 +993,7 @@ void Client::sendSubscription(const Jid &jid, const TQString &type)
j->go(true);
}
-void Client::setPresence(const Status &s)
+void Client::setPresence(const tqStatus &s)
{
JT_Presence *j = new JT_Presence(rootTask());
j->pres(s);
@@ -1001,9 +1001,9 @@ void Client::setPresence(const Status &s)
// update our resourceList
ppPresence(jid(), s);
- //ResourceList::Iterator rit = d->resourceList.find(resource());
+ //ResourceList::Iterator rit = d->resourceList.tqfind(resource());
//Resource &r = *rit;
- //r.setStatus(s);
+ //r.settqStatus(s);
}
TQString Client::OSName() const
@@ -1097,7 +1097,7 @@ void Client::addExtension(const TQString& ext, const Features& features)
void Client::removeExtension(const TQString& ext)
{
- if (d->extension_features.contains(ext)) {
+ if (d->extension_features.tqcontains(ext)) {
d->extension_features.remove(ext);
d->capsExt = extensions().join(" ");
}
@@ -1155,22 +1155,22 @@ public:
bool done;
};
-Task::Task(Task *parent)
-:TQObject(parent)
+Task::Task(Task *tqparent)
+:TQObject(tqparent)
{
init();
- d->client = parent->client();
+ d->client = tqparent->client();
d->id = client()->genUniqueId();
connect(d->client, TQT_SIGNAL(disconnected()), TQT_SLOT(clientDisconnected()));
}
-Task::Task(Client *parent, bool)
+Task::Task(Client *tqparent, bool)
:TQObject(0)
{
init();
- d->client = parent;
+ d->client = tqparent;
connect(d->client, TQT_SIGNAL(disconnected()), TQT_SLOT(clientDisconnected()));
}
@@ -1189,9 +1189,9 @@ void Task::init()
d->done = false;
}
-Task *Task::parent() const
+Task *Task::tqparent() const
{
- return (Task *)TQObject::parent();
+ return (Task *)TQObject::tqparent();
}
Client *Task::client() const
@@ -1233,12 +1233,12 @@ void Task::go(bool autoDelete)
bool Task::take(const TQDomElement &x)
{
- const TQObjectList *p = children();
- if(!p)
+ const TQObjectList p = childrenListObject();
+ if(p.isEmpty())
return false;
// pass along the xml
- TQObjectListIt it(*p);
+ TQObjectListIt it(p);
Task *t;
for(; it.current(); ++it) {
TQObject *obj = it.current();
@@ -1362,7 +1362,7 @@ void Task::debug(const char *fmt, ...)
void Task::debug(const TQString &str)
{
- client()->debug(TQString("%1: ").arg(className()) + str);
+ client()->debug(TQString("%1: ").tqarg(className()) + str);
}
bool Task::iqVerify(const TQDomElement &x, const Jid &to, const TQString &id, const TQString &xmlns)
@@ -1461,9 +1461,9 @@ bool LiveRosterItem::isAvailable() const
return false;
}
-const Status & LiveRosterItem::lastUnavailableStatus() const
+const tqStatus & LiveRosterItem::lastUnavailabletqStatus() const
{
- return v_lastUnavailableStatus;
+ return v_lastUnavailabletqStatus;
}
bool LiveRosterItem::flagForDelete() const
@@ -1471,9 +1471,9 @@ bool LiveRosterItem::flagForDelete() const
return v_flagForDelete;
}
-void LiveRosterItem::setLastUnavailableStatus(const Status &s)
+void LiveRosterItem::setLastUnavailabletqStatus(const tqStatus &s)
{
- v_lastUnavailableStatus = s;
+ v_lastUnavailabletqStatus = s;
}
void LiveRosterItem::setFlagForDelete(bool b)
@@ -1499,7 +1499,7 @@ void LiveRoster::flagAllForDelete()
(*it).setFlagForDelete(true);
}
-LiveRoster::Iterator LiveRoster::find(const Jid &j, bool compareRes)
+LiveRoster::Iterator LiveRoster::tqfind(const Jid &j, bool compareRes)
{
Iterator it;
for(it = begin(); it != end(); ++it) {
@@ -1509,7 +1509,7 @@ LiveRoster::Iterator LiveRoster::find(const Jid &j, bool compareRes)
return it;
}
-LiveRoster::ConstIterator LiveRoster::find(const Jid &j, bool compareRes) const
+LiveRoster::ConstIterator LiveRoster::tqfind(const Jid &j, bool compareRes) const
{
ConstIterator it;
for(it = begin(); it != end(); ++it) {