Exemple #1
0
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;
}