Commit a8a85765 authored by Luigi Toscano's avatar Luigi Toscano

Port the Jabber directory to categorized logging

Use a specific logging category, trying to use the same naming
used in the port of the original code for Jabber (taken from Kopete).
parent eb8386fb
......@@ -98,6 +98,11 @@ ecm_qt_declare_logging_category(ksirk_SRCS
IDENTIFIER KSIRK_LOG
CATEGORY_NAME org.kde.ksirk)
ecm_qt_declare_logging_category(ksirk_SRCS
HEADER jabber_protocol_debug.h
IDENTIFIER JABBER_PROTOCOL_LOG
CATEGORY_NAME org.kde.ksirk.jabber)
set(ksirk_UI
Dialogs/qplayersetupdialog.ui
Dialogs/newGameDialog.ui
......
......@@ -40,7 +40,6 @@
#include <kcomponentdata.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <KLocalizedString>
#include <kaboutdata.h>
......@@ -87,7 +86,7 @@
JabberAccount::JabberAccount (JabberProtocol * parent, const QString & accountId)
:JabberProtocol( parent/*, accountId, false */)
{
kDebug(JABBER_DEBUG_GLOBAL) << "Instantiating new account " << accountId;
qCDebug(JABBER_PROTOCOL_LOG) << "Instantiating new account " << accountId;
m_protocol = parent;
......@@ -233,7 +232,7 @@ return false;
void JabberAccount::connectWithPassword ( const QString &password )
{
kDebug (JABBER_DEBUG_GLOBAL) << "called";
qCDebug(JABBER_PROTOCOL_LOG) << "called";
/* Cancel connection process if no password has been supplied. */
if ( password.isEmpty () )
......@@ -362,11 +361,11 @@ void JabberAccount::connectWithPassword ( const QString &password )
timezoneString = str;
//END of timezone code
kDebug (JABBER_DEBUG_GLOBAL) << "Determined timezone " << timezoneString << " with UTC offset " << timezoneOffset << " hours.";
qCDebug(JABBER_PROTOCOL_LOG) << "Determined timezone " << timezoneString << " with UTC offset " << timezoneOffset << " hours.";
m_jabberClient->setTimeZone ( timezoneString, timezoneOffset );
kDebug (JABBER_DEBUG_GLOBAL) << "Connecting to Jabber server " << server() << ":" << port();
qCDebug(JABBER_PROTOCOL_LOG) << "Connecting to Jabber server " << server() << ":" << port();
setPresence( XMPP::Status ("connecting", "", 0, true) );
......@@ -391,7 +390,7 @@ void JabberAccount::connectWithPassword ( const QString &password )
void JabberAccount::slotClientDebugMessage ( const QString &msg )
{
kDebug (JABBER_DEBUG_PROTOCOL) << msg;
qCDebug(JABBER_PROTOCOL_LOG) << msg;
}
......@@ -507,7 +506,7 @@ void JabberAccount::slotHandleTLSWarning (
QCA::TLS::IdentityResult identityResult,
QCA::Validity validityResult )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "Handling TLS warning...";
qCDebug(JABBER_PROTOCOL_LOG) << "Handling TLS warning...";
if ( handleTLSWarning ( m_jabberClient, identityResult, validityResult ) )
{
......@@ -524,7 +523,7 @@ void JabberAccount::slotHandleTLSWarning (
void JabberAccount::slotClientError ( JabberClient::ErrorCode errorCode )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "Handling client error...";
qCDebug(JABBER_PROTOCOL_LOG) << "Handling client error...";
switch ( errorCode )
{
......@@ -541,12 +540,12 @@ void JabberAccount::slotClientError ( JabberClient::ErrorCode errorCode )
void JabberAccount::slotConnected ()
{
kDebug (JABBER_DEBUG_GLOBAL) << "Connected to Jabber server.";
qCDebug(JABBER_PROTOCOL_LOG) << "Connected to Jabber server.";
#ifdef SUPPORT_JINGLE
if(!m_voiceCaller)
{
kDebug(JABBER_DEBUG_GLOBAL) << "Creating Jingle Voice caller...";
qCDebug(JABBER_PROTOCOL_LOG) << "Creating Jingle Voice caller...";
m_voiceCaller = new JingleVoiceCaller( this );
QObject::connect(m_voiceCaller,SIGNAL(incoming(Jid)),this,SLOT(slotIncomingVoiceCall(Jid)));
m_voiceCaller->initialize();
......@@ -555,7 +554,7 @@ void JabberAccount::slotConnected ()
#if 0
if(!m_jingleSessionManager)
{
kDebug(JABBER_DEBUG_GLOBAL) << "Creating Jingle Session Manager...";
qCDebug(JABBER_PROTOCOL_LOG) << "Creating Jingle Session Manager...";
m_jingleSessionManager = new JingleSessionManager( this );
QObject::connect(m_jingleSessionManager, SIGNAL(incomingSession(QString,JingleSession*)), this, SLOT(slotIncomingJingleSession(QString,JingleSession*)));
}
......@@ -565,7 +564,7 @@ void JabberAccount::slotConnected ()
m_jabberClient->client()->addExtension("voice-v1", Features(QString("http://www.google.com/xmpp/protocol/voice/v1")));
#endif
kDebug (JABBER_DEBUG_GLOBAL) << "Requesting roster...";
qCDebug(JABBER_PROTOCOL_LOG) << "Requesting roster...";
m_jabberClient->requestRoster ();
}
......@@ -584,7 +583,7 @@ void JabberAccount::slotRosterRequestFinished ( bool success )
* information before we have updated our roster with actual
* contacts from the server! (Iris won't forward presence
* information in that case either). */
kDebug (JABBER_DEBUG_GLOBAL) << "Setting initial presence...";
qCDebug(JABBER_PROTOCOL_LOG) << "Setting initial presence...";
setPresence ( m_initialPresence );
}
......@@ -604,7 +603,7 @@ void JabberAccount::setOnlineStatus( const JabberProtocol::OnlineStatus& status,
if( status == JabberProtocol::JabberOffline )
{
xmppStatus.setIsAvailable( false );
kDebug (JABBER_DEBUG_GLOBAL) << "CROSS YOUR FINGERS! THIS IS GONNA BE WILD";
qCDebug(JABBER_PROTOCOL_LOG) << "CROSS YOUR FINGERS! THIS IS GONNA BE WILD";
disconnect (0/*Manual*/, xmppStatus);
return;
}
......@@ -634,11 +633,11 @@ void JabberAccount::setStatusMessage( const QString& statusMessage )
void JabberAccount::disconnect ( int reason )
{
kDebug (JABBER_DEBUG_GLOBAL) << "disconnect() called";
qCDebug(JABBER_PROTOCOL_LOG) << "disconnect() called";
if (isConnected ())
{
kDebug (JABBER_DEBUG_GLOBAL) << "Still connected, closing connection...";
qCDebug(JABBER_PROTOCOL_LOG) << "Still connected, closing connection...";
/* Tell backend class to disconnect. */
m_jabberClient->disconnect ();
}
......@@ -656,18 +655,18 @@ void JabberAccount::disconnect ( int reason )
* Instead, the instance will lurk until the next
* connection attempt.
*/
kDebug (JABBER_DEBUG_GLOBAL) << "Disconnected.";
qCDebug(JABBER_PROTOCOL_LOG) << "Disconnected.";
// disconnected ( reason );
}
void JabberAccount::disconnect( int reason, XMPP::Status &status )
{
kDebug (JABBER_DEBUG_GLOBAL) << "disconnect( reason, status ) called";
qCDebug(JABBER_PROTOCOL_LOG) << "disconnect( reason, status ) called";
if (isConnected ())
{
kDebug (JABBER_DEBUG_GLOBAL) << "Still connected, closing connection...";
qCDebug(JABBER_PROTOCOL_LOG) << "Still connected, closing connection...";
/* Tell backend class to disconnect. */
m_jabberClient->disconnect (status);
}
......@@ -684,7 +683,7 @@ void JabberAccount::disconnect( int reason, XMPP::Status &status )
* Instead, the instance will lurk until the next
* connection attempt.
*/
kDebug (JABBER_DEBUG_GLOBAL) << "Disconnected.";
qCDebug(JABBER_PROTOCOL_LOG) << "Disconnected.";
// Kopete::Account::disconnected ( reason );
}
......@@ -706,7 +705,7 @@ void JabberAccount::slotDisconnect ()
void JabberAccount::slotCSDisconnected ()
{
kDebug (JABBER_DEBUG_GLOBAL) << "Disconnected from Jabber server.";
qCDebug(JABBER_PROTOCOL_LOG) << "Disconnected from Jabber server.";
/*
* We should delete the JabberClient instance here,
......@@ -990,19 +989,19 @@ void JabberAccount::handleStreamError (int streamError, int streamCondition, int
void JabberAccount::slotCSError ( int error )
{
kDebug(JABBER_DEBUG_GLOBAL) << "Error in stream signalled.";
qCDebug(JABBER_PROTOCOL_LOG) << "Error in stream signalled.";
if ( ( error == XMPP::ClientStream::ErrAuth )
&& ( client()->clientStream()->errorCondition () == XMPP::ClientStream::NotAuthorized ) )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "Incorrect password, retrying.";
qCDebug(JABBER_PROTOCOL_LOG) << "Incorrect password, retrying.";
disconnect(/*Kopete::Account::BadPassword*/0);
}
else
{
int errorClass = 0;
kDebug ( JABBER_DEBUG_GLOBAL ) << "Disconnecting.";
qCDebug(JABBER_PROTOCOL_LOG) << "Disconnecting.";
// display message to user
if(!m_removing) //when removing the account, connection errors are normal.
......@@ -1019,7 +1018,7 @@ void JabberAccount::slotCSError ( int error )
/* Set presence (usually called by dialog widget). */
void JabberAccount::setPresence ( const XMPP::Status &status )
{
kDebug(JABBER_DEBUG_GLOBAL) << "Status: " << status.show () << ", Reason: " << status.status ();
qCDebug(JABBER_PROTOCOL_LOG) << "Status: " << status.show () << ", Reason: " << status.status ();
// fetch input status
XMPP::Status newStatus = status;
......@@ -1055,7 +1054,7 @@ void JabberAccount::setPresence ( const XMPP::Status &status )
*/
if (isConnected())
{
kDebug(JABBER_DEBUG_GLOBAL) << "Sending new presence to the server.";
qCDebug(JABBER_PROTOCOL_LOG) << "Sending new presence to the server.";
XMPP::JT_Presence * task = new XMPP::JT_Presence ( client()->rootTask ());
......@@ -1064,7 +1063,7 @@ void JabberAccount::setPresence ( const XMPP::Status &status )
}
else
{
kDebug(JABBER_DEBUG_GLOBAL) << "We were not connected, presence update aborted.";
qCDebug(JABBER_PROTOCOL_LOG) << "We were not connected, presence update aborted.";
}
}
......@@ -1089,14 +1088,14 @@ void JabberAccount::slotXMPPConsole ()
void JabberAccount::slotSubscription (const XMPP::Jid & jid, const QString & type)
{
kDebug (JABBER_DEBUG_GLOBAL) << jid.full () << ", " << type;
qCDebug(JABBER_PROTOCOL_LOG) << jid.full () << ", " << type;
if (type == "subscribe")
{
/*
* A user wants to subscribe to our presence.
*/
kDebug (JABBER_DEBUG_GLOBAL) << jid.full () << " is asking for authorization to subscribe.";
qCDebug(JABBER_PROTOCOL_LOG) << jid.full () << " is asking for authorization to subscribe.";
// Is the user already in our contact list?
// JabberBaseContact *contact = contactPool()->findExactMatch( jid );
......@@ -1122,7 +1121,7 @@ void JabberAccount::slotSubscription (const XMPP::Jid & jid, const QString & typ
/*
* Someone else removed our authorization to see them.
*/
kDebug (JABBER_DEBUG_GLOBAL) << jid.full() << " revoked our presence authorization";
qCDebug(JABBER_PROTOCOL_LOG) << jid.full() << " revoked our presence authorization";
XMPP::JT_Roster *task;
......@@ -1237,7 +1236,7 @@ void JabberAccount::slotContactUpdated (const XMPP::RosterItem & item)
* a roster item here.
*/
kDebug (JABBER_DEBUG_GLOBAL) << "New roster item " << item.jid().full () << " (Subscription: " << item.subscription().toString () << ")";
qCDebug(JABBER_PROTOCOL_LOG) << "New roster item " << item.jid().full () << " (Subscription: " << item.subscription().toString () << ")";
/*
* See if the contact need to be added, according to the criterias of
......@@ -1314,7 +1313,7 @@ void JabberAccount::slotContactUpdated (const XMPP::RosterItem & item)
/* Kopete::MetaContact *metaContact=c->metaContact();
if(metaContact->isTemporary())
return;
kDebug (JABBER_DEBUG_GLOBAL) << c->contactId() <<
qCDebug(JABBER_PROTOCOL_LOG) << c->contactId() <<
" is on the contact list while it shouldn't. we are removing it. - " << c << endl;
delete c;
if(metaContact->contacts().isEmpty())
......@@ -1325,7 +1324,7 @@ void JabberAccount::slotContactUpdated (const XMPP::RosterItem & item)
void JabberAccount::slotContactDeleted (const XMPP::RosterItem & item)
{
kDebug (JABBER_DEBUG_GLOBAL) << "Deleting contact " << item.jid().full ();
qCDebug(JABBER_PROTOCOL_LOG) << "Deleting contact " << item.jid().full ();
// since the contact instance will get deleted here, the GUI should be updated
contactPool()->removeContact ( item.jid () );
......@@ -1334,7 +1333,7 @@ void JabberAccount::slotContactDeleted (const XMPP::RosterItem & item)
void JabberAccount::slotReceivedMessage (const XMPP::Message & message)
{
kDebug (JABBER_DEBUG_GLOBAL) << "New message from " << message.from().full ();
qCDebug(JABBER_PROTOCOL_LOG) << "New message from " << message.from().full ();
JabberBaseContact *contactFrom;
......@@ -1355,7 +1354,7 @@ void JabberAccount::slotReceivedMessage (const XMPP::Message & message)
*/
if ( !contactFrom )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "WARNING: Received a groupchat message but couldn't find room contact. Ignoring message.";
qCDebug(JABBER_PROTOCOL_LOG) << "WARNING: Received a groupchat message but couldn't find room contact. Ignoring message.";
return;
}
}
......@@ -1382,7 +1381,7 @@ void JabberAccount::slotReceivedMessage (const XMPP::Message & message)
XMPP::Jid jid ( message.from().userHost () );
// the contact is not in our pool, add it as a temporary contact
kDebug (JABBER_DEBUG_GLOBAL) << jid.full () << " is unknown to us, creating temporary contact.";
qCDebug(JABBER_PROTOCOL_LOG) << jid.full () << " is unknown to us, creating temporary contact.";
// Kopete::MetaContact *metaContact = new Kopete::MetaContact ();
//
......@@ -1415,7 +1414,7 @@ void JabberAccount::slotJoinNewChat ()
void JabberAccount::slotGroupChatJoined (const XMPP::Jid & jid)
{
kDebug (JABBER_DEBUG_GLOBAL) << "Joined groupchat " << jid.full ();
qCDebug(JABBER_PROTOCOL_LOG) << "Joined groupchat " << jid.full ();
// Create new meta contact that holds the groupchat contact.
// Kopete::MetaContact *metaContact = new Kopete::MetaContact ();
......@@ -1452,7 +1451,7 @@ void JabberAccount::slotGroupChatJoined (const XMPP::Jid & jid)
void JabberAccount::slotGroupChatLeft (const XMPP::Jid & jid)
{
kDebug (JABBER_DEBUG_GLOBAL) << "Left groupchat " << jid.full ();
qCDebug(JABBER_PROTOCOL_LOG) << "Left groupchat " << jid.full ();
// remove group contact from list
// Kopete::Contact *contact =
......@@ -1474,20 +1473,20 @@ void JabberAccount::slotGroupChatLeft (const XMPP::Jid & jid)
void JabberAccount::slotGroupChatPresence (const XMPP::Jid & jid, const XMPP::Status & status)
{
kDebug (JABBER_DEBUG_GLOBAL) << "Received groupchat presence for room " << jid.full ();
qCDebug(JABBER_PROTOCOL_LOG) << "Received groupchat presence for room " << jid.full ();
// fetch room contact (the one without resource)
JabberGroupContact *groupContact = dynamic_cast<JabberGroupContact *>( contactPool()->findExactMatch ( XMPP::Jid ( jid.userHost () ) ) );
if ( !groupContact )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "WARNING: Groupchat presence signalled, but we don't have a room contact?";
qCDebug(JABBER_PROTOCOL_LOG) << "WARNING: Groupchat presence signalled, but we don't have a room contact?";
return;
}
if ( !status.isAvailable () )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << jid.full () << " has become unavailable, removing from room";
qCDebug(JABBER_PROTOCOL_LOG) << jid.full () << " has become unavailable, removing from room";
// remove the resource from the pool
resourcePool()->removeResource ( jid, XMPP::Resource ( jid.resource (), status ) );
......@@ -1508,7 +1507,7 @@ void JabberAccount::slotGroupChatPresence (const XMPP::Jid & jid, const XMPP::St
void JabberAccount::slotGroupChatError (const XMPP::Jid &jid, int error, const QString &reason)
{
kDebug (JABBER_DEBUG_GLOBAL) << "Group chat error - room " << jid.full () << " had error " << error << " (" << reason << ")";
qCDebug(JABBER_PROTOCOL_LOG) << "Group chat error - room " << jid.full () << " had error " << error << " (" << reason << ")";
switch (error)
{
......@@ -1564,7 +1563,7 @@ void JabberAccount::slotGroupChatError (const XMPP::Jid &jid, int error, const Q
void JabberAccount::slotResourceAvailable (const XMPP::Jid & jid, const XMPP::Resource & resource)
{
kDebug (JABBER_DEBUG_GLOBAL) << "New resource available for " << jid.full();
qCDebug(JABBER_PROTOCOL_LOG) << "New resource available for " << jid.full();
resourcePool()->addResource ( jid, resource );
......@@ -1573,7 +1572,7 @@ void JabberAccount::slotResourceAvailable (const XMPP::Jid & jid, const XMPP::Re
void JabberAccount::slotResourceUnavailable (const XMPP::Jid & jid, const XMPP::Resource & resource)
{
kDebug (JABBER_DEBUG_GLOBAL) << "Resource now unavailable for " << jid.full ();
qCDebug(JABBER_PROTOCOL_LOG) << "Resource now unavailable for " << jid.full ();
resourcePool()->removeResource ( jid, resource );
......@@ -1615,11 +1614,11 @@ void JabberAccount::slotGetServices ()
// void JabberAccount::slotIncomingVoiceCall( const Jid &jid )
// {
// kDebug(JABBER_DEBUG_GLOBAL) ;
// qCDebug(JABBER_PROTOCOL_LOG) ;
// #ifdef SUPPORT_JINGLE
// if(voiceCaller())
// {
// kDebug(JABBER_DEBUG_GLOBAL) << "Showing voice dialog.";
// qCDebug(JABBER_PROTOCOL_LOG) << "Showing voice dialog.";
// JingleVoiceSessionDialog *voiceDialog = new JingleVoiceSessionDialog( jid, voiceCaller() );
// voiceDialog->show();
// }
......
......@@ -16,7 +16,6 @@
* *************************************************************************
*/
#include <kdebug.h>
#include <KLocalizedString>
#include <kiconloader.h>
#include <kstandarddirs.h>
......@@ -91,7 +90,7 @@ bool JabberBaseContact::isReachable ()
void JabberBaseContact::updateContact ( const XMPP::RosterItem & item )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "Synchronizing local copy of " << contactId() << " with information received from server. (name='" << item.name() << "' groups='" << item.groups() << "')";
qCDebug(JABBER_PROTOCOL_LOG) << "Synchronizing local copy of " << contactId() << " with information received from server. (name='" << item.name() << "' groups='" << item.groups() << "')";
mRosterItem = item;
......@@ -114,7 +113,7 @@ void JabberBaseContact::updateContact ( const XMPP::RosterItem & item )
if ( !item.name().isEmpty () && item.name() != item.jid().bare()
&& metaContact()->customDisplayName() != item.name () )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "setting display name of " << contactId () << " to " << item.name();
qCDebug(JABBER_PROTOCOL_LOG) << "setting display name of " << contactId () << " to " << item.name();
metaContact()->setDisplayName ( item.name () );
}
}
......@@ -196,13 +195,13 @@ void JabberBaseContact::updateContact ( const XMPP::RosterItem & item )
foreach ( Kopete::Group *group, groupsToRemoveFrom )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "Removing " << contactId() << " from group " << group->displayName ();
qCDebug(JABBER_PROTOCOL_LOG) << "Removing " << contactId() << " from group " << group->displayName ();
metaContact()->removeFromGroup ( group );
}
foreach ( Kopete::Group *group, groupsToAddTo )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "Adding " << contactId() << " to group " << group->displayName ();
qCDebug(JABBER_PROTOCOL_LOG) << "Adding " << contactId() << " to group " << group->displayName ();
metaContact()->addToGroup ( group );
}
}
......@@ -293,7 +292,7 @@ void JabberBaseContact::updateResourceList ()
void JabberBaseContact::reevaluateStatus ()
{
kDebug (JABBER_DEBUG_GLOBAL) << "Determining new status for " << contactId ();
qCDebug(JABBER_PROTOCOL_LOG) << "Determining new status for " << contactId ();
Kopete::OnlineStatus status;
XMPP::Resource resource = account()->resourcePool()->bestResource ( mRosterItem.jid () );
......@@ -316,7 +315,7 @@ void JabberBaseContact::reevaluateStatus ()
updateResourceList ();
kDebug (JABBER_DEBUG_GLOBAL) << "New status for " << contactId () << " is " << status.description ();
qCDebug(JABBER_PROTOCOL_LOG) << "New status for " << contactId () << " is " << status.description ();
setOnlineStatus ( status );
/*
......@@ -398,7 +397,7 @@ void JabberBaseContact::slotUserInfo( )
void JabberBaseContact::setPropertiesFromVCard ( const XMPP::VCard &vCard )
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "Updating vCard for " << contactId ();
qCDebug(JABBER_PROTOCOL_LOG) << "Updating vCard for " << contactId ();
// update vCard cache timestamp if this is not a temporary contact
if ( metaContact() && !metaContact()->isTemporary () )
......@@ -626,7 +625,7 @@ void JabberBaseContact::setPropertiesFromVCard ( const XMPP::VCard &vCard )
// photo() is a QByteArray
if ( !vCard.photo().isEmpty() )
{
kDebug( JABBER_DEBUG_GLOBAL ) << "Contact has a photo embedded into his vCard.";
qCDebug(JABBER_PROTOCOL_LOG) << "Contact has a photo embedded into his vCard.";
// QImage is used to save to disk in PNG later.
contactPhoto = QImage::fromData( vCard.photo() );
......@@ -644,7 +643,7 @@ void JabberBaseContact::setPropertiesFromVCard ( const XMPP::VCard &vCard )
}
kDebug( JABBER_DEBUG_GLOBAL ) << "Contact photo is a URI.";
qCDebug(JABBER_PROTOCOL_LOG) << "Contact photo is a URI.";
contactPhoto = QImage( tempPhotoPath );
......@@ -662,7 +661,7 @@ void JabberBaseContact::setPropertiesFromVCard ( const XMPP::VCard &vCard )
// Save the image to the disk, then set the property.
if(!entry.path.isNull())
{
kDebug( JABBER_DEBUG_GLOBAL ) << "Setting photo for contact: " << contactId();
qCDebug(JABBER_PROTOCOL_LOG) << "Setting photo for contact: " << contactId();
setProperty( protocol()->propPhoto, entry.path );
}
......
......@@ -19,7 +19,6 @@
#include <kopetecontact.h>
#include <kdebug.h>
#include <QAction>
#include <kselectaction.h>
#include <KLocalizedString>
......
......@@ -18,15 +18,15 @@
***************************************************************************/
#include <qobject.h>
#include <kdebug.h>
#include <ksocketfactory.h>
#include "jabber_protocol_debug.h"
#include "jabberbytestream.h"
// #include "jabberprotocol.h"
JabberByteStream::JabberByteStream ( QObject *parent )
: ByteStream ( parent )
{
kDebug ( ) << "Instantiating new Jabber byte stream.";
qCDebug(JABBER_PROTOCOL_LOG) << "Instantiating new Jabber byte stream.";
// reset close tracking flag
mClosing = false;
......@@ -36,7 +36,7 @@ JabberByteStream::JabberByteStream ( QObject *parent )
void JabberByteStream::connect ( QString host, int port )
{
kDebug ( ) << k_funcinfo << "Connecting to " << host << ", port " << port << endl;
qCDebug(JABBER_PROTOCOL_LOG) << Q_FUNC_INFO << "Connecting to " << host << ", port " << port << endl;
mClosing = false;
......@@ -59,14 +59,14 @@ bool JabberByteStream::isOpen () const
void JabberByteStream::close ()
{
kDebug ( ) << "Closing stream.";
qCDebug(JABBER_PROTOCOL_LOG) << "Closing stream.";
// close the socket and set flag that we are closing it ourselves
mClosing = true;
if (mSocket) {
kDebug ( ) << k_funcinfo << "socket is not null" << endl;
qCDebug(JABBER_PROTOCOL_LOG) << Q_FUNC_INFO << "socket is not null" << endl;
mSocket->close();
kDebug ( ) << k_funcinfo << "socket closed" << endl;
qCDebug(JABBER_PROTOCOL_LOG) << Q_FUNC_INFO << "socket closed" << endl;
delete mSocket;
mSocket=NULL;
}
......@@ -106,7 +106,7 @@ void JabberByteStream::slotConnected ()
void JabberByteStream::slotConnectionClosed ()
{
kDebug ( ) << "Socket has been closed.";
qCDebug(JABBER_PROTOCOL_LOG) << "Socket has been closed.";
// depending on who closed the socket, emit different signals
if ( !mClosing )
......@@ -124,7 +124,7 @@ void JabberByteStream::slotConnectionClosed ()
void JabberByteStream::slotReadyRead ()
{
kDebug ( ) << "called: available: " << socket()->bytesAvailable ();
qCDebug(JABBER_PROTOCOL_LOG) << "called: available: " << socket()->bytesAvailable ();
appendRead ( socket()->readAll() );
emit readyRead ();
......@@ -140,7 +140,7 @@ void JabberByteStream::slotBytesWritten ( qint64 bytes )
void JabberByteStream::slotError ( QAbstractSocket::SocketError code )
{
kDebug ( ) << "Socket error '" << mSocket->errorString() << "' - Code : " << code;
qCDebug(JABBER_PROTOCOL_LOG) << "Socket error '" << mSocket->errorString() << "' - Code : " << code;
emit error ( code );
}
......
......@@ -19,6 +19,7 @@
*************************************************************************
*/
#include "jabbercapabilitiesmanager.h"
#include "jabber_protocol_debug.h"
#include <qstring.h>
#include <qstringlist.h>
......@@ -28,7 +29,6 @@
#include <qtextstream.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#include <xmpp_tasks.h>
......@@ -171,7 +171,7 @@ void JabberCapabilitiesManager::CapabilitiesInformation::addJid(const Jid& jid,
void JabberCapabilitiesManager::CapabilitiesInformation::removeJid(const Jid& jid)
{
kDebug(JABBER_DEBUG_GLOBAL) << "Unregistering " << QString(jid.full()).replace('%',"%%");
qCDebug(JABBER_PROTOCOL_LOG) << "Unregistering " << QString(jid.full()).replace('%',"%%");
JidList::Iterator it = m_jids.begin();
while( it != m_jids.end() )
......@@ -189,7 +189,7 @@ void JabberCapabilitiesManager::CapabilitiesInformation::removeJid(const Jid& ji
QPair<Jid,JabberAccount*> JabberCapabilitiesManager::CapabilitiesInformation::nextJid(const Jid& jid, const Task* t)
{
kDebug(JABBER_DEBUG_GLOBAL) << "Looking for next JID";
qCDebug(JABBER_PROTOCOL_LOG) << "Looking for next JID";
JidList::ConstIterator it = m_jids.constBegin(), itEnd = m_jids.constEnd();
for( ; it != itEnd; ++it)
......@@ -199,14 +199,14 @@ QPair<Jid,JabberAccount*> JabberCapabilitiesManager::CapabilitiesInformation::ne
it++;
if (it == itEnd)
{
kDebug(JABBER_DEBUG_GLOBAL) << "No more JIDs";
qCDebug(JABBER_PROTOCOL_LOG) << "No more JIDs";
return QPair<Jid,JabberAccount*>(Jid(),0L);
}
else if( (*it).second->isConnected() )
{
//qDebug("caps.cpp: Account isn't active");
kDebug(JABBER_DEBUG_GLOBAL) << "Account isn't connected.";
qCDebug(JABBER_PROTOCOL_LOG) << "Account isn't connected.";
return QPair<Jid,JabberAccount*>( (*it).first,(*it).second );
}
......@@ -270,7 +270,7 @@ void JabberCapabilitiesManager::CapabilitiesInformation::fromXml(const QDomEleme
{
if( element.tagName() != "info")
{
kDebug(JABBER_DEBUG_GLOBAL) << "Invalid info element";
qCDebug(JABBER_PROTOCOL_LOG) << "Invalid info element";
return;
}
......@@ -282,7 +282,7 @@ void JabberCapabilitiesManager::CapabilitiesInformation::fromXml(const QDomEleme
QDomElement infoElement = node.toElement();
if( infoElement.isNull() )
{
kDebug(JABBER_DEBUG_GLOBAL) << "Null element";
qCDebug(JABBER_PROTOCOL_LOG) << "Null element";
continue;
}
......@@ -300,7 +300,7 @@ void JabberCapabilitiesManager::CapabilitiesInformation::fromXml(const QDomEleme
}
else
{
kDebug(JABBER_DEBUG_GLOBAL) << "Unknown element";
qCDebug(JABBER_PROTOCOL_LOG) << "Unknown element";
}
m_discovered = true;
......@@ -335,7 +335,7 @@ JabberCapabilitiesManager::~JabberCapabilitiesManager()
void JabberCapabilitiesManager::removeAccount(JabberAccount *account)
{
kDebug(JABBER_DEBUG_GLOBAL) << "Removing account " << account->accountId();
qCDebug(JABBER_PROTOCOL_LOG) << "Removing account " << account->accountId();
QList<CapabilitiesInformation> info = d->capabilitiesInformationMap.values();
......@@ -394,7 +394,7 @@ void JabberCapabilitiesManager::updateCapabilities(JabberAccount *account, const
{