2 /***************************************************************************
3 jabberclient.cpp - Generic Jabber Client Class
5 begin : Sat May 25 2005
6 copyright : (C) 2005 by Till Gerken <till@tantalo.net>
7 (C) 2006 by Michaƫl Larouche <larouche@kde.org>
8 Copyright 2006 by Tommi Rantala <tommi.rantala@cs.helsinki.fi>
10 Kopete (C) 2001-2006 Kopete developers
11 <kopete-devel@kde.org>.
12 ***************************************************************************/
14 /***************************************************************************
16 * This program is free software; you can redistribute it and/or modify *
17 * it under the terms of the GNU General Public License as published by *
18 * the Free Software Foundation; either version 2 of the License, or *
19 * (at your option) any later version. *
21 ***************************************************************************/
23 #include "jabberclient.h"
32 #include <filetransfer.h>
33 #include <jinglesessionmanager.h>
34 #include <xmpp_tasks.h>
36 #include "privacymanager.h"
38 #define JABBER_PENALTY_TIME 2
40 class JabberClient::Private
44 : jabberClient(0L), jabberClientStream(0L), jabberClientConnector(0L), jabberTLS(0L),
45 jabberTLSHandler(0L), privacyManager(0L)
51 jabberClient
->close ();
55 delete jabberClientStream
;
56 delete jabberClientConnector
;
57 delete jabberTLSHandler
;
59 // privacyManager will be deleted with jabberClient, its parent's parent
67 XMPP::Client
*jabberClient
;
68 XMPP::ClientStream
*jabberClientStream
;
69 XMPP::AdvancedConnector
*jabberClientConnector
;
71 XMPP::QCATLSHandler
*jabberTLSHandler
;
72 QCA::Initializer qcaInit
;
73 PrivacyManager
*privacyManager
;
75 // ignore TLS warnings
76 bool ignoreTLSWarnings
;
78 // current S5B server instance
79 static XMPP::S5BServer
*s5bServer
;
80 // address list being handled by the S5B server instance
81 static QStringList s5bAddressList
;
83 static int s5bServerPort
;
88 // whether TLS (or direct SSL in case of the old protocol) should be used
91 // whether direct SSL connections should be used
94 // use XMPP 1.0 or the older protocol version
97 // whether SSL support should be probed in case the old protocol is used
100 // override the default server name and port (only pre-XMPP 1.0)
105 // allow transmission of plaintext passwords
106 bool allowPlainTextPassword
;
108 // enable file transfers
109 bool fileTransfersEnabled
;
111 // current penalty time
112 int currentPenaltyTime
;
114 // client information
115 QString clientName
, clientVersion
, osName
;
117 // timezone information
118 QString timeZoneName
;
121 // Caps(JEP-0115: Entity Capabilities) information
122 QString capsNode
, capsVersion
;
123 DiscoItem::Identity discoIdentity
;
126 XMPP::S5BServer
*JabberClient::Private::s5bServer
= 0L;
127 QStringList
JabberClient::Private::s5bAddressList
;
128 int JabberClient::Private::s5bServerPort
= 8010;
130 JabberClient::JabberClient ()
135 // initiate penalty timer
136 QTimer::singleShot ( JABBER_PENALTY_TIME
* 1000, this, SLOT ( slotUpdatePenaltyTime () ) );
140 JabberClient::~JabberClient ()
145 void JabberClient::cleanUp ()
147 if ( d
->jabberClient
)
149 d
->jabberClient
->close ();
152 delete d
->jabberClient
;
153 delete d
->jabberClientStream
;
154 delete d
->jabberClientConnector
;
155 delete d
->jabberTLSHandler
;
157 // privacyManager will be deleted with jabberClient, its parent's parent
159 d
->jabberClient
= 0L;
160 d
->jabberClientStream
= 0L;
161 d
->jabberClientConnector
= 0L;
162 d
->jabberTLSHandler
= 0L;
164 d
->privacyManager
= 0L;
166 d
->currentPenaltyTime
= 0;
168 d
->jid
= XMPP::Jid ();
171 setForceTLS ( false );
173 setUseXMPP09 ( false );
174 setProbeSSL ( false );
176 setOverrideHost ( false );
178 setAllowPlainTextPassword ( true );
180 setFileTransfersEnabled ( false );
181 setS5BServerPort ( 8010 );
183 setClientName ( QString() );
184 setClientVersion ( QString() );
185 setOSName ( QString() );
187 setTimeZone ( "UTC", 0 );
189 setIgnoreTLSWarnings ( false );
193 void JabberClient::slotUpdatePenaltyTime ()
196 if ( d
->currentPenaltyTime
>= JABBER_PENALTY_TIME
)
197 d
->currentPenaltyTime
-= JABBER_PENALTY_TIME
;
199 d
->currentPenaltyTime
= 0;
201 QTimer::singleShot ( JABBER_PENALTY_TIME
* 1000, this, SLOT ( slotUpdatePenaltyTime () ) );
205 void JabberClient::setIgnoreTLSWarnings ( bool flag
)
208 d
->ignoreTLSWarnings
= flag
;
212 bool JabberClient::ignoreTLSWarnings ()
215 return d
->ignoreTLSWarnings
;
219 bool JabberClient::setS5BServerPort ( int port
)
222 d
->s5bServerPort
= port
;
224 if ( fileTransfersEnabled () )
226 return s5bServer()->start ( port
);
233 int JabberClient::s5bServerPort () const
236 return d
->s5bServerPort
;
240 XMPP::S5BServer
*JabberClient::s5bServer ()
245 d
->s5bServer
= new XMPP::S5BServer ();
246 QObject::connect ( d
->s5bServer
, SIGNAL ( destroyed () ), this, SLOT ( slotS5BServerGone () ) );
249 * Try to start the server at the default port here.
250 * We have no way of notifying the caller of an error.
251 * However, since the caller will usually also
252 * use setS5BServerPort() to ensure the correct
253 * port, we can return an error code there.
255 if ( fileTransfersEnabled () )
257 s5bServer()->start ( d
->s5bServerPort
);
265 void JabberClient::slotS5BServerGone ()
270 if ( d
->jabberClient
)
271 d
->jabberClient
->s5bManager()->setServer( 0L );
275 void JabberClient::addS5BServerAddress ( const QString
&address
)
279 d
->s5bAddressList
.append ( address
);
281 // now filter the list without dupes
282 foreach( QStringList::const_reference str
, d
->s5bAddressList
)
284 if ( !newList
.contains ( str
) )
285 newList
.append ( str
);
288 s5bServer()->setHostList ( newList
);
292 void JabberClient::removeS5BServerAddress ( const QString
&address
)
296 int idx
= d
->s5bAddressList
.indexOf( address
);
299 d
->s5bAddressList
.removeAt(idx
);
301 if ( d
->s5bAddressList
.isEmpty () )
308 // now filter the list without dupes
309 foreach( QStringList::const_reference str
, d
->s5bAddressList
)
311 if ( !newList
.contains ( str
) )
312 newList
.append ( str
);
315 s5bServer()->setHostList ( newList
);
320 void JabberClient::setForceTLS ( bool flag
)
327 bool JabberClient::forceTLS () const
334 void JabberClient::setUseSSL ( bool flag
)
341 bool JabberClient::useSSL () const
348 void JabberClient::setUseXMPP09 ( bool flag
)
355 bool JabberClient::useXMPP09 () const
362 void JabberClient::setProbeSSL ( bool flag
)
369 bool JabberClient::probeSSL () const
376 void JabberClient::setOverrideHost ( bool flag
, const QString
&server
, int port
)
379 d
->overrideHost
= flag
;
385 bool JabberClient::overrideHost () const
388 return d
->overrideHost
;
392 void JabberClient::setAllowPlainTextPassword ( bool flag
)
395 d
->allowPlainTextPassword
= flag
;
399 bool JabberClient::allowPlainTextPassword () const
402 return d
->allowPlainTextPassword
;
406 void JabberClient::setFileTransfersEnabled ( bool flag
, const QString
&localAddress
)
409 d
->fileTransfersEnabled
= flag
;
410 d
->localAddress
= localAddress
;
414 QString
JabberClient::localAddress () const
417 return d
->localAddress
;
421 bool JabberClient::fileTransfersEnabled () const
424 return d
->fileTransfersEnabled
;
428 void JabberClient::setClientName ( const QString
&clientName
)
431 d
->clientName
= clientName
;
435 QString
JabberClient::clientName () const
438 return d
->clientName
;
442 void JabberClient::setClientVersion ( const QString
&clientVersion
)
445 d
->clientVersion
= clientVersion
;
449 QString
JabberClient::clientVersion () const
452 return d
->clientVersion
;
456 void JabberClient::setOSName ( const QString
&osName
)
463 QString
JabberClient::osName () const
470 void JabberClient::setCapsNode( const QString
&capsNode
)
472 d
->capsNode
= capsNode
;
475 QString
JabberClient::capsNode() const
480 void JabberClient::setCapsVersion( const QString
&capsVersion
)
482 d
->capsVersion
= capsVersion
;
485 QString
JabberClient::capsVersion() const
487 return d
->capsVersion
;
490 QString
JabberClient::capsExt() const
494 return d
->jabberClient
->capsExt();
499 void JabberClient::setDiscoIdentity( DiscoItem::Identity identity
)
501 d
->discoIdentity
= identity
;
504 DiscoItem::Identity
JabberClient::discoIdentity() const
506 return d
->discoIdentity
;
509 void JabberClient::setTimeZone ( const QString
&timeZoneName
, int timeZoneOffset
)
512 d
->timeZoneName
= timeZoneName
;
513 d
->timeZoneOffset
= timeZoneOffset
;
517 QString
JabberClient::timeZoneName () const
520 return d
->timeZoneName
;
524 int JabberClient::timeZoneOffset () const
527 return d
->timeZoneOffset
;
531 int JabberClient::getPenaltyTime ()
534 int currentTime
= d
->currentPenaltyTime
;
536 d
->currentPenaltyTime
+= JABBER_PENALTY_TIME
;
542 XMPP::Client
*JabberClient::client () const
545 return d
->jabberClient
;
549 XMPP::ClientStream
*JabberClient::clientStream () const
552 return d
->jabberClientStream
;
556 XMPP::AdvancedConnector
*JabberClient::clientConnector () const
559 return d
->jabberClientConnector
;
563 XMPP::Task
*JabberClient::rootTask () const
568 return client()->rootTask ();
577 XMPP::FileTransferManager
*JabberClient::fileTransferManager () const
582 return client()->fileTransferManager ();
591 PrivacyManager
*JabberClient::privacyManager () const
593 return d
->privacyManager
;
596 XMPP::Jid
JabberClient::jid () const
603 JabberClient::ErrorCode
JabberClient::connect ( const XMPP::Jid
&jid
, const QString
&password
, bool auth
)
606 * Close any existing connection.
608 if ( d
->jabberClient
)
610 d
->jabberClient
->close ();
613 d
->password
= password
;
616 * Return an error if we should force TLS but it's not available.
618 if ( ( forceTLS () || useSSL () || probeSSL () ) && !QCA::isSupported ("tls" ) )
625 * Instantiate connector, responsible for dealing with the socket.
626 * This class uses KDE's socket code, which in turn makes use of
627 * the global proxy settings.
629 d
->jabberClientConnector
= new XMPP::AdvancedConnector
;
631 d
->jabberClientConnector
->setOptSSL ( useSSL () );
635 if ( overrideHost () )
637 d
->jabberClientConnector
->setOptHostPort ( d
->server
, d
->port
);
640 d
->jabberClientConnector
->setOptProbe ( probeSSL () );
645 * Setup authentication layer
647 if ( QCA::isSupported ("tls") )
649 d
->jabberTLS
= new QCA::TLS
;
650 d
->jabberTLS
->setTrustedCertificates(QCA::systemStore());
651 d
->jabberTLSHandler
= new QCATLSHandler(d
->jabberTLS
);
652 d
->jabberTLSHandler
->setXMPPCertCheck(true);
654 QObject::connect ( d
->jabberTLSHandler
, SIGNAL ( tlsHandshaken() ), SLOT ( slotTLSHandshaken () ) );
658 * Instantiate client stream which handles the network communication by referring
659 * to a connector (proxying etc.) and a TLS handler (security layer)
661 d
->jabberClientStream
= new XMPP::ClientStream ( d
->jabberClientConnector
, d
->jabberTLSHandler
);
664 using namespace XMPP
;
665 QObject::connect ( d
->jabberClientStream
, SIGNAL ( needAuthParams(bool, bool, bool) ),
666 this, SLOT ( slotCSNeedAuthParams (bool, bool, bool) ) );
667 QObject::connect ( d
->jabberClientStream
, SIGNAL ( authenticated () ),
668 this, SLOT ( slotCSAuthenticated () ) );
669 QObject::connect ( d
->jabberClientStream
, SIGNAL ( connectionClosed () ),
670 this, SLOT ( slotCSDisconnected () ) );
671 QObject::connect ( d
->jabberClientStream
, SIGNAL ( delayedCloseFinished () ),
672 this, SLOT ( slotCSDisconnected () ) );
673 QObject::connect ( d
->jabberClientStream
, SIGNAL ( warning (int) ),
674 this, SLOT ( slotCSWarning (int) ) );
675 QObject::connect ( d
->jabberClientStream
, SIGNAL ( error (int) ),
676 this, SLOT ( slotCSError (int) ) );
679 d
->jabberClientStream
->setOldOnly ( useXMPP09 () );
682 * Initiate anti-idle timer (will be triggered every 55 seconds).
684 d
->jabberClientStream
->setNoopTime ( 55000 );
687 * Allow plaintext password authentication or not?
689 d
->jabberClientStream
->setAllowPlain( allowPlainTextPassword () ? XMPP::ClientStream::AllowPlain
: XMPP::ClientStream::NoAllowPlain
);
692 * Setup client layer.
694 d
->jabberClient
= new XMPP::Client ( this );
697 * Setup privacy manager
699 d
->privacyManager
= new PrivacyManager ( rootTask() );
702 * Enable file transfer (IP and server will be set after connection
703 * has been established.
705 if ( fileTransfersEnabled () )
707 d
->jabberClient
->setFileTransferEnabled ( true );
710 using namespace XMPP
;
711 QObject::connect ( d
->jabberClient
->fileTransferManager(), SIGNAL ( incomingReady() ),
712 this, SLOT ( slotIncomingFileTransfer () ) );
716 /*if (jingleEnabled())
719 #ifdef JINGLE_SUPPORT
720 d
->jabberClient
->setJingleEnabled(true);
723 using namespace XMPP
;
724 QObject::connect ( d
->jabberClient
->jingleSessionManager(), SIGNAL ( incomingSession() ),
725 this, SLOT ( slotIncomingJingleSession () ) );
728 d
->jabberClient
->setJingleEnabled(false);
732 /* This should only be done here to connect the signals, otherwise it is a
736 using namespace XMPP
;
737 QObject::connect ( d
->jabberClient
, SIGNAL ( subscription (const Jid
&, const QString
&, const QString
&) ),
738 this, SLOT ( slotSubscription (const Jid
&, const QString
&) ) );
739 QObject::connect ( d
->jabberClient
, SIGNAL ( rosterRequestFinished ( bool, int, const QString
& ) ),
740 this, SLOT ( slotRosterRequestFinished ( bool, int, const QString
& ) ) );
741 QObject::connect ( d
->jabberClient
, SIGNAL ( rosterItemAdded (const RosterItem
&) ),
742 this, SLOT ( slotNewContact (const RosterItem
&) ) );
743 QObject::connect ( d
->jabberClient
, SIGNAL ( rosterItemUpdated (const RosterItem
&) ),
744 this, SLOT ( slotContactUpdated (const RosterItem
&) ) );
745 QObject::connect ( d
->jabberClient
, SIGNAL ( rosterItemRemoved (const RosterItem
&) ),
746 this, SLOT ( slotContactDeleted (const RosterItem
&) ) );
747 QObject::connect ( d
->jabberClient
, SIGNAL ( resourceAvailable (const Jid
&, const Resource
&) ),
748 this, SLOT ( slotResourceAvailable (const Jid
&, const Resource
&) ) );
749 QObject::connect ( d
->jabberClient
, SIGNAL ( resourceUnavailable (const Jid
&, const Resource
&) ),
750 this, SLOT ( slotResourceUnavailable (const Jid
&, const Resource
&) ) );
751 QObject::connect ( d
->jabberClient
, SIGNAL ( messageReceived (const Message
&) ),
752 this, SLOT ( slotReceivedMessage (const Message
&) ) );
753 QObject::connect ( d
->jabberClient
, SIGNAL ( groupChatJoined (const Jid
&) ),
754 this, SLOT ( slotGroupChatJoined (const Jid
&) ) );
755 QObject::connect ( d
->jabberClient
, SIGNAL ( groupChatLeft (const Jid
&) ),
756 this, SLOT ( slotGroupChatLeft (const Jid
&) ) );
757 QObject::connect ( d
->jabberClient
, SIGNAL ( groupChatPresence (const Jid
&, const Status
&) ),
758 this, SLOT ( slotGroupChatPresence (const Jid
&, const Status
&) ) );
759 QObject::connect ( d
->jabberClient
, SIGNAL ( groupChatError (const Jid
&, int, const QString
&) ),
760 this, SLOT ( slotGroupChatError (const Jid
&, int, const QString
&) ) );
761 //QObject::connect ( d->jabberClient, SIGNAL (debugText (const QString &) ),
762 // this, SLOT ( slotPsiDebug (const QString &) ) );
763 QObject::connect ( d
->jabberClient
, SIGNAL ( xmlIncoming(const QString
& ) ),
764 this, SLOT ( slotIncomingXML (const QString
&) ) );
765 QObject::connect ( d
->jabberClient
, SIGNAL ( xmlOutgoing(const QString
& ) ),
766 this, SLOT ( slotOutgoingXML (const QString
&) ) );
769 d
->jabberClient
->setClientName ( clientName () );
770 d
->jabberClient
->setClientVersion ( clientVersion () );
771 d
->jabberClient
->setOSName ( osName () );
773 // Set caps information
774 d
->jabberClient
->setCapsNode( capsNode() );
775 d
->jabberClient
->setCapsVersion( capsVersion() );
777 // Set Disco Identity
778 d
->jabberClient
->setIdentity( discoIdentity() );
780 d
->jabberClient
->setTimeZone ( timeZoneName (), timeZoneOffset () );
782 // Additional features
783 d
->jabberClient
->setFeatures(Features("http://jabber.org/protocol/xhtml-im"));
785 d
->jabberClient
->connectToServer ( d
->jabberClientStream
, jid
, auth
);
791 void JabberClient::disconnect ()
794 if ( d
->jabberClient
)
796 d
->jabberClient
->close ();
805 void JabberClient::disconnect( XMPP::Status
&reason
)
807 if ( d
->jabberClient
)
809 if ( d
->jabberClientStream
->isActive() )
811 XMPP::JT_Presence
*pres
= new JT_Presence(rootTask());
812 reason
.setIsAvailable( false );
813 pres
->pres( reason
);
816 d
->jabberClientStream
->close();
817 d
->jabberClient
->close();
826 bool JabberClient::isConnected () const
829 if ( d
->jabberClient
)
831 return d
->jabberClient
->isActive ();
838 void JabberClient::joinGroupChat ( const QString
&host
, const QString
&room
, const QString
&nick
)
841 client()->groupChatJoin ( host
, room
, nick
);
845 void JabberClient::joinGroupChat ( const QString
&host
, const QString
&room
, const QString
&nick
, const QString
&password
)
847 client()->groupChatJoin ( host
, room
, nick
, password
);
851 void JabberClient::leaveGroupChat ( const QString
&host
, const QString
&room
)
854 client()->groupChatLeave ( host
, room
);
858 void JabberClient::setGroupChatStatus( const QString
& host
, const QString
& room
, const XMPP::Status
& status
)
860 client()->groupChatSetStatus( host
, room
, status
);
863 void JabberClient::changeGroupChatNick( const QString
& host
, const QString
& room
, const QString
& nick
, const XMPP::Status
& status
)
865 client()->groupChatChangeNick( host
, room
, nick
, status
);
869 void JabberClient::sendMessage ( const XMPP::Message
&message
)
872 client()->sendMessage ( message
);
876 void JabberClient::send ( const QString
&packet
)
879 client()->send ( packet
);
883 void JabberClient::requestRoster ()
886 client()->rosterRequest ();
890 void JabberClient::slotPsiDebug ( const QString
& _msg
)
894 msg
= msg
.replace( QRegExp( "<password>[^<]*</password>\n" ), "<password>[Filtered]</password>\n" );
895 msg
= msg
.replace( QRegExp( "<digest>[^<]*</digest>\n" ), "<digest>[Filtered]</digest>\n" );
897 emit
debugMessage ( "Psi: " + msg
);
901 void JabberClient::slotIncomingXML ( const QString
& _msg
)
905 msg
= msg
.replace( QRegExp( "<password>[^<]*</password>\n" ), "<password>[Filtered]</password>\n" );
906 msg
= msg
.replace( QRegExp( "<digest>[^<]*</digest>\n" ), "<digest>[Filtered]</digest>\n" );
908 emit
debugMessage ( "XML IN: " + msg
);
909 emit
incomingXML ( msg
);
912 void JabberClient::slotOutgoingXML ( const QString
& _msg
)
916 msg
= msg
.replace( QRegExp( "<password>[^<]*</password>\n" ), "<password>[Filtered]</password>\n" );
917 msg
= msg
.replace( QRegExp( "<digest>[^<]*</digest>\n" ), "<digest>[Filtered]</digest>\n" );
919 emit
debugMessage ( "XML OUT: " + msg
);
920 emit
outgoingXML ( msg
);
923 void JabberClient::slotTLSHandshaken ()
926 emit
debugMessage ( "TLS handshake done, testing certificate validity..." );
928 // FIXME: in the future, this should be handled by KDE, not QCA
930 QCA::TLS::IdentityResult identityResult
= d
->jabberTLS
->peerIdentityResult();
931 QCA::Validity validityResult
= d
->jabberTLS
->peerCertificateValidity();
933 if ( identityResult
== QCA::TLS::Valid
&& validityResult
== QCA::ValidityGood
)
935 emit
debugMessage ( "Identity and certificate valid, continuing." );
937 // valid certificate, continue
938 d
->jabberTLSHandler
->continueAfterHandshake ();
942 emit
debugMessage ( "Certificate is not valid, asking user what to do next." );
944 // certificate is not valid, query the user
945 if ( ignoreTLSWarnings () )
947 emit
debugMessage ( "We are supposed to ignore TLS warnings, continuing." );
948 d
->jabberTLSHandler
->continueAfterHandshake ();
951 emit
tlsWarning ( identityResult
, validityResult
);
956 void JabberClient::continueAfterTLSWarning ()
959 if ( d
->jabberTLSHandler
)
961 d
->jabberTLSHandler
->continueAfterHandshake ();
966 void JabberClient::slotCSNeedAuthParams ( bool user
, bool pass
, bool realm
)
968 emit
debugMessage ( "Sending auth credentials..." );
972 d
->jabberClientStream
->setUsername ( jid().node () );
977 d
->jabberClientStream
->setPassword ( d
->password
);
982 d
->jabberClientStream
->setRealm ( jid().domain () );
985 d
->jabberClientStream
->continueAfterParams ();
989 void JabberClient::slotCSAuthenticated ()
991 emit
debugMessage ( "Connected to Jabber server." );
994 * Determine local IP address.
995 * FIXME: This is ugly!
997 if ( localAddress().isEmpty () )
999 // code for Iris-type bytestreams
1000 ByteStream
*irisByteStream
= d
->jabberClientConnector
->stream();
1001 if ( irisByteStream
->inherits ( "BSocket" ) || irisByteStream
->inherits ( "XMPP::BSocket" ) )
1003 d
->localAddress
= ( (BSocket
*)irisByteStream
)->address().toString ();
1007 if ( fileTransfersEnabled () )
1009 // setup file transfer
1010 addS5BServerAddress ( localAddress () );
1011 d
->jabberClient
->s5bManager()->setServer ( s5bServer () );
1015 //update the ressource:
1016 d
->jid
= d
->jabberClientStream
->jid();
1018 // start the client operation
1019 d
->jabberClient
->start ( jid().domain (), jid().node (), d
->password
, jid().resource () );
1021 if (!d
->jabberClientStream
->old())
1023 XMPP::JT_Session
*j
= new XMPP::JT_Session(rootTask());
1024 QObject::connect(j
, SIGNAL(finished()), this, SLOT(slotSessionStarted()));
1033 void JabberClient::slotSessionStarted()
1035 XMPP::JT_Session
*j
= static_cast<XMPP::JT_Session
*>(sender());
1039 emit
csError ( -1 );
1043 void JabberClient::slotCSDisconnected ()
1047 * We should delete the XMPP::Client instance here,
1048 * but timers etc prevent us from doing so. (Psi does
1049 * not like to be deleted from a slot).
1052 emit
debugMessage ( "Disconnected, freeing up file transfer port..." );
1054 // delete local address from S5B server
1055 removeS5BServerAddress ( localAddress () );
1057 emit
csDisconnected ();
1061 void JabberClient::slotCSWarning ( int warning
)
1064 emit
debugMessage ( "Client stream warning." );
1067 * FIXME: process all other warnings
1071 //case XMPP::ClientStream::WarnOldVersion:
1072 case XMPP::ClientStream::WarnNoTLS
:
1076 emit
error ( NoTLS
);
1082 d
->jabberClientStream
->continueAfterWarning ();
1086 void JabberClient::slotCSError ( int error
)
1089 emit
debugMessage ( "Client stream error." );
1091 emit
csError ( error
);
1095 void JabberClient::slotRosterRequestFinished ( bool success
, int /*statusCode*/, const QString
&/*statusString*/ )
1098 emit
rosterRequestFinished ( success
);
1102 void JabberClient::slotIncomingFileTransfer ()
1105 emit
incomingFileTransfer ();
1109 void JabberClient::slotNewContact ( const XMPP::RosterItem
&item
)
1112 emit
newContact ( item
);
1116 void JabberClient::slotContactDeleted ( const RosterItem
&item
)
1119 emit
contactDeleted ( item
);
1123 void JabberClient::slotContactUpdated ( const RosterItem
&item
)
1126 emit
contactUpdated ( item
);
1130 void JabberClient::slotResourceAvailable ( const Jid
&jid
, const Resource
&resource
)
1133 emit
resourceAvailable ( jid
, resource
);
1137 void JabberClient::slotResourceUnavailable ( const Jid
&jid
, const Resource
&resource
)
1140 emit
resourceUnavailable ( jid
, resource
);
1144 void JabberClient::slotReceivedMessage ( const Message
&message
)
1147 emit
messageReceived ( message
);
1151 void JabberClient::slotGroupChatJoined ( const Jid
&jid
)
1154 emit
groupChatJoined ( jid
);
1158 void JabberClient::slotGroupChatLeft ( const Jid
&jid
)
1161 emit
groupChatLeft ( jid
);
1165 void JabberClient::slotGroupChatPresence ( const Jid
&jid
, const Status
&status
)
1168 emit
groupChatPresence ( jid
, status
);
1172 void JabberClient::slotGroupChatError ( const Jid
&jid
, int error
, const QString
&reason
)
1175 emit
groupChatError ( jid
, error
, reason
);
1179 void JabberClient::slotSubscription ( const Jid
&jid
, const QString
&type
)
1182 emit
subscription ( jid
, type
);
1187 #include "jabberclient.moc"