void KMessageJabber::slotGroupChatPresence(const XMPP::Jid& jid, const XMPP::Status& status) { kDebug() << jid.full() << status.status(); if (jid.full() == mPeerJid && !status.isAvailable()) { emit connectionBroken(); } }
XMPP::Status makeStatus(int x, const QString &str, int priority) { XMPP::Status s = makeStatus(x,str); if (priority > 127) s.setPriority(127); else if (priority < -128) s.setPriority(-128); else s.setPriority(priority); return s; }
Status fromIrisStatus(XMPP::Status status) { Status newstatus; if (status.isAvailable()) newstatus.setType("Online"); else if (status.isInvisible()) newstatus.setType("DoNotDisturb"); else newstatus.setType("Offline"); if (status.show() == "away") newstatus.setType("Away"); else if (status.show() == "xa") newstatus.setType("NotAvailable"); else if (status.show() == "dnd") newstatus.setType("DoNotDisturb"); else if (status.show() == "chat") newstatus.setType("FreeForChat"); QString description = status.status(); description.replace("\r\n", "\n"); description.replace('\r', '\n'); newstatus.setDescription(description); return newstatus; }
void JabberTransport::setOnlineStatus( const Kopete::OnlineStatus& status , const QString &reason) { #if 0 if( status.status() == Kopete::OnlineStatus::Offline ) { disconnect( Kopete::Account::Manual ); return; } if( isConnecting () ) { errorConnectionInProgress (); return; } XMPP::Status xmppStatus ( "", reason ); switch ( status.internalStatus () ) { case JabberProtocol::JabberFreeForChat: xmppStatus.setShow ( "chat" ); break; case JabberProtocol::JabberOnline: xmppStatus.setShow ( "" ); break; case JabberProtocol::JabberAway: xmppStatus.setShow ( "away" ); break; case JabberProtocol::JabberXA: xmppStatus.setShow ( "xa" ); break; case JabberProtocol::JabberDND: xmppStatus.setShow ( "dnd" ); break; case JabberProtocol::JabberInvisible: xmppStatus.setIsInvisible ( true ); break; } if ( !isConnected () ) { // we are not connected yet, so connect now m_initialPresence = xmppStatus; connect (); } else { setPresence ( xmppStatus ); } #endif }
void StatusPreset::fromXml(const QDomElement &el) { // FIXME: This is the old format. Should be removed in the future if (el.tagName() == "item") { setName(el.attribute("name")); setMessage(el.text()); return; } if (el.isNull() || el.tagName() != "preset") return; setName(el.attribute("name")); setMessage(el.text()); if (el.hasAttribute("priority")) setPriority(el.attribute("priority").toInt()); XMPP::Status status; status.setType(el.attribute("status", "away")); setStatus(status.type()); }
XMPP::Status toIrisStatus(Status status) { XMPP::Status s = XMPP::Status(); const QString &type = status.type(); if ("Online" == type) s.setType(XMPP::Status::Online); else if ("FreeForChat" == type) s.setType(XMPP::Status::FFC); else if ("DoNotDisturb" == type) s.setType(XMPP::Status::DND); else if ("NotAvailable" == type) s.setType(XMPP::Status::XA); else if ("Away" == type) s.setType(XMPP::Status::Away); else if ("Invisible" == type) s.setType(XMPP::Status::DND); else s.setType(XMPP::Status::Offline); s.setStatus(status.description()); return s; }
void JabberClient::disconnect( XMPP::Status &reason) { if (jabberClient) { if (JabberClientStream->isActive()) { XMPP::JT_Presence *pres = new JT_Presence(rootTask()); reason.setIsAvailable( false); pres->pres( reason); pres->go(); JabberClientStream->close(); jabberClient->close(); } } else cleanUp(); }
XMPP::Status JabberProtocol::kosToStatus( const Kopete::OnlineStatus & status , const QString & message ) { XMPP::Status xmppStatus ( "", message ); if( status.status() == Kopete::OnlineStatus::Offline ) { xmppStatus.setIsAvailable( false ); } switch ( status.internalStatus () ) { case JabberProtocol::JabberFreeForChat: xmppStatus.setShow ( "chat" ); break; case JabberProtocol::JabberOnline: xmppStatus.setShow ( "" ); break; case JabberProtocol::JabberAway: xmppStatus.setShow ( "away" ); break; case JabberProtocol::JabberXA: xmppStatus.setShow ( "xa" ); break; case JabberProtocol::JabberDND: xmppStatus.setShow ( "dnd" ); break; case JabberProtocol::JabberInvisible: xmppStatus.setIsInvisible ( true ); break; } return xmppStatus; }
XMPP::Status::Type makeSTATUS(const XMPP::Status &s) { return s.type(); }