From 8dca1c1f0fd1e239982f8567e760065bde12b3aa Mon Sep 17 00:00:00 2001 From: rjarosz Date: Fri, 23 Feb 2007 19:33:06 +0000 Subject: [PATCH] Merge ICQ/AIM Presence stuff and clean it. Show Xtraz Status icons in contact list. Add Xtraz Status icons from Miranda. Add AIM overlay icon. git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdenetwork@636665 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/protocols/oscar/CMakeLists.txt | 5 +- kopete/protocols/oscar/aim/CMakeLists.txt | 2 +- kopete/protocols/oscar/aim/aimaccount.cpp | 67 ++-- kopete/protocols/oscar/aim/aimaccount.h | 13 +- kopete/protocols/oscar/aim/aimcontact.cpp | 21 +- kopete/protocols/oscar/aim/aimpresence.cpp | 379 -------------------- kopete/protocols/oscar/aim/aimpresence.h | 160 --------- kopete/protocols/oscar/aim/aimprotocol.cpp | 6 +- kopete/protocols/oscar/aim/aimprotocol.h | 6 +- kopete/protocols/oscar/aim/aimstatusmanager.cpp | 114 ++++++ kopete/protocols/oscar/aim/aimstatusmanager.h | 41 +++ kopete/protocols/oscar/aim/icqcontact.cpp | 19 +- .../oscar/icons/cr16-action-aim_overlay.png | Bin 0 -> 443 bytes .../oscar/icons/hi16-action-icq_xstatus0.png | Bin 0 -> 930 bytes .../oscar/icons/hi16-action-icq_xstatus1.png | Bin 0 -> 1048 bytes .../oscar/icons/hi16-action-icq_xstatus10.png | Bin 0 -> 996 bytes .../oscar/icons/hi16-action-icq_xstatus11.png | Bin 0 -> 824 bytes .../oscar/icons/hi16-action-icq_xstatus12.png | Bin 0 -> 777 bytes .../oscar/icons/hi16-action-icq_xstatus13.png | Bin 0 -> 947 bytes .../oscar/icons/hi16-action-icq_xstatus14.png | Bin 0 -> 973 bytes .../oscar/icons/hi16-action-icq_xstatus15.png | Bin 0 -> 925 bytes .../oscar/icons/hi16-action-icq_xstatus16.png | Bin 0 -> 931 bytes .../oscar/icons/hi16-action-icq_xstatus17.png | Bin 0 -> 637 bytes .../oscar/icons/hi16-action-icq_xstatus18.png | Bin 0 -> 959 bytes .../oscar/icons/hi16-action-icq_xstatus19.png | Bin 0 -> 940 bytes .../oscar/icons/hi16-action-icq_xstatus2.png | Bin 0 -> 909 bytes .../oscar/icons/hi16-action-icq_xstatus20.png | Bin 0 -> 953 bytes .../oscar/icons/hi16-action-icq_xstatus21.png | Bin 0 -> 961 bytes .../oscar/icons/hi16-action-icq_xstatus22.png | Bin 0 -> 846 bytes .../oscar/icons/hi16-action-icq_xstatus23.png | Bin 0 -> 498 bytes .../oscar/icons/hi16-action-icq_xstatus24.png | Bin 0 -> 791 bytes .../oscar/icons/hi16-action-icq_xstatus25.png | Bin 0 -> 901 bytes .../oscar/icons/hi16-action-icq_xstatus26.png | Bin 0 -> 640 bytes .../oscar/icons/hi16-action-icq_xstatus27.png | Bin 0 -> 869 bytes .../oscar/icons/hi16-action-icq_xstatus28.png | Bin 0 -> 944 bytes .../oscar/icons/hi16-action-icq_xstatus29.png | Bin 0 -> 1039 bytes .../oscar/icons/hi16-action-icq_xstatus3.png | Bin 0 -> 956 bytes .../oscar/icons/hi16-action-icq_xstatus30.png | Bin 0 -> 645 bytes .../oscar/icons/hi16-action-icq_xstatus31.png | Bin 0 -> 912 bytes .../oscar/icons/hi16-action-icq_xstatus4.png | Bin 0 -> 888 bytes .../oscar/icons/hi16-action-icq_xstatus5.png | Bin 0 -> 972 bytes .../oscar/icons/hi16-action-icq_xstatus6.png | Bin 0 -> 875 bytes .../oscar/icons/hi16-action-icq_xstatus7.png | Bin 0 -> 634 bytes .../oscar/icons/hi16-action-icq_xstatus8.png | Bin 0 -> 1027 bytes .../oscar/icons/hi16-action-icq_xstatus9.png | Bin 0 -> 811 bytes kopete/protocols/oscar/icq/CMakeLists.txt | 2 +- kopete/protocols/oscar/icq/aimcontact.cpp | 21 +- kopete/protocols/oscar/icq/icqaccount.cpp | 72 ++-- kopete/protocols/oscar/icq/icqaccount.h | 12 +- kopete/protocols/oscar/icq/icqcontact.cpp | 43 ++- kopete/protocols/oscar/icq/icqpresence.cpp | 384 --------------------- kopete/protocols/oscar/icq/icqpresence.h | 162 --------- kopete/protocols/oscar/icq/icqprotocol.cpp | 5 +- kopete/protocols/oscar/icq/icqprotocol.h | 11 +- kopete/protocols/oscar/icq/icqstatusmanager.cpp | 114 ++++++ kopete/protocols/oscar/icq/icqstatusmanager.h | 48 +++ kopete/protocols/oscar/icqcontactbase.cpp | 16 +- kopete/protocols/oscar/oscarcontact.cpp | 7 + kopete/protocols/oscar/oscarcontact.h | 11 + kopete/protocols/oscar/oscarpresence.cpp | 43 +++ kopete/protocols/oscar/oscarpresence.h | 84 +++++ .../protocols/oscar/oscarpresencesdataclasses.cpp | 64 ++++ kopete/protocols/oscar/oscarpresencesdataclasses.h | 138 ++++++++ kopete/protocols/oscar/oscarprotocol.h | 2 + kopete/protocols/oscar/oscarstatusmanager.cpp | 266 ++++++++++++++ kopete/protocols/oscar/oscarstatusmanager.h | 110 ++++++ 66 files changed, 1218 insertions(+), 1230 deletions(-) delete mode 100644 kopete/protocols/oscar/aim/aimpresence.cpp delete mode 100644 kopete/protocols/oscar/aim/aimpresence.h create mode 100644 kopete/protocols/oscar/aim/aimstatusmanager.cpp create mode 100644 kopete/protocols/oscar/aim/aimstatusmanager.h create mode 100644 kopete/protocols/oscar/icons/cr16-action-aim_overlay.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus0.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus1.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus10.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus11.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus12.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus13.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus14.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus15.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus16.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus17.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus18.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus19.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus2.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus20.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus21.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus22.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus23.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus24.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus25.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus26.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus27.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus28.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus29.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus3.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus30.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus31.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus4.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus5.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus6.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus7.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus8.png create mode 100644 kopete/protocols/oscar/icons/hi16-action-icq_xstatus9.png delete mode 100644 kopete/protocols/oscar/icq/icqpresence.cpp delete mode 100644 kopete/protocols/oscar/icq/icqpresence.h create mode 100644 kopete/protocols/oscar/icq/icqstatusmanager.cpp create mode 100644 kopete/protocols/oscar/icq/icqstatusmanager.h create mode 100644 kopete/protocols/oscar/oscarpresence.cpp create mode 100644 kopete/protocols/oscar/oscarpresence.h create mode 100644 kopete/protocols/oscar/oscarpresencesdataclasses.cpp create mode 100644 kopete/protocols/oscar/oscarpresencesdataclasses.h create mode 100644 kopete/protocols/oscar/oscarstatusmanager.cpp create mode 100644 kopete/protocols/oscar/oscarstatusmanager.h diff --git a/kopete/protocols/oscar/CMakeLists.txt b/kopete/protocols/oscar/CMakeLists.txt index 2264aded7..d0c72703a 100644 --- a/kopete/protocols/oscar/CMakeLists.txt +++ b/kopete/protocols/oscar/CMakeLists.txt @@ -24,7 +24,10 @@ set(kopete_oscar_LIB_SRCS oscarversionupdater.cpp oscarprivacyengine.cpp aimcontactbase.cpp - icqcontactbase.cpp ) + icqcontactbase.cpp + oscarpresence.cpp + oscarpresencesdataclasses.cpp + oscarstatusmanager.cpp) kde4_add_ui_files(kopete_oscar_LIB_SRCS oscarencodingselectionbase.ui diff --git a/kopete/protocols/oscar/aim/CMakeLists.txt b/kopete/protocols/oscar/aim/CMakeLists.txt index 99aee6719..a32e076d3 100644 --- a/kopete/protocols/oscar/aim/CMakeLists.txt +++ b/kopete/protocols/oscar/aim/CMakeLists.txt @@ -29,7 +29,7 @@ set(kopete_aim_PART_SRCS aimaccount.cpp aimcontact.cpp icqcontact.cpp - aimpresence.cpp + aimstatusmanager.cpp aimuserinfo.cpp aimjoinchat.cpp aimchatsession.cpp ) diff --git a/kopete/protocols/oscar/aim/aimaccount.cpp b/kopete/protocols/oscar/aim/aimaccount.cpp index 40def2e32..9c1633132 100644 --- a/kopete/protocols/oscar/aim/aimaccount.cpp +++ b/kopete/protocols/oscar/aim/aimaccount.cpp @@ -1,7 +1,7 @@ /* aimaccount.cpp - Oscar Protocol Plugin, AIM part - Kopete (c) 2002-2003 by the Kopete developers + Kopete (c) 2002-2007 by the Kopete developers ************************************************************************* * * @@ -48,6 +48,7 @@ #include "client.h" #include "contactmanager.h" #include "oscarsettings.h" +#include "oscarstatusmanager.h" const Oscar::DWORD AIM_ONLINE = 0x0; @@ -65,8 +66,11 @@ void AIMMyselfContact::userInfoUpdated() { Oscar::DWORD extendedStatus = details().extendedStatus(); kDebug( OSCAR_AIM_DEBUG ) << k_funcinfo << "extendedStatus is " << QString::number( extendedStatus, 16 ) << endl; - AIM::Presence presence = AIM::Presence::fromOscarStatus( extendedStatus, details().userClass() ); - setOnlineStatus( presence.toOnlineStatus() ); + + AIMProtocol* p = static_cast(protocol()); + Oscar::Presence presence = p->statusManager()->presenceOf( extendedStatus, details().userClass() ); + setOnlineStatus( p->statusManager()->onlineStatusOf( presence ) ); + setProperty( Kopete::Global::Properties::self()->statusMessage(), static_cast( account() )->engine()->statusMessage() ); } @@ -208,7 +212,8 @@ AIMAccount::AIMAccount(Kopete::Protocol *parent, QString accountID) kDebug(14152) << k_funcinfo << accountID << ": Called."<< endl; AIMMyselfContact* mc = new AIMMyselfContact( this ); setMyself( mc ); - mc->setOnlineStatus( AIM::Presence( AIM::Presence::Offline ).toOnlineStatus() ); + mc->setOnlineStatus( protocol()->statusManager()->onlineStatusOf( Oscar::Presence( Oscar::Presence::Offline ) ) ); + QString profile = configGroup()->readEntry( "Profile", i18n( "Visit the Kopete website at http://kopete.kde.org") ); mc->setOwnProfile( profile ); @@ -235,9 +240,9 @@ AIMProtocol* AIMAccount::protocol() const return static_cast(OscarAccount::protocol()); } -AIM::Presence AIMAccount::presence() +Oscar::Presence AIMAccount::presence() { - return AIM::Presence::fromOnlineStatus( myself()->onlineStatus() ); + return protocol()->statusManager()->presenceOf( myself()->onlineStatus() ); } OscarContact *AIMAccount::createNewContact( const QString &contactId, Kopete::MetaContact *parentContact, const OContact& ssiItem ) @@ -283,51 +288,51 @@ KActionMenu* AIMAccount::actionMenu() KToggleAction* actionInvisible = new KToggleAction( i18n( "In&visible" ), this ); //, "actionInvisible" ); - AIM::Presence pres( presence().type(), presence().flags() | AIM::Presence::Invisible ); - actionInvisible->setIcon( KIcon( pres.toOnlineStatus().iconFor( this ) ) ); - actionInvisible->setChecked( (presence().flags() & AIM::Presence::Invisible) == AIM::Presence::Invisible ); + Oscar::Presence pres( presence().type(), presence().flags() | Oscar::Presence::Invisible ); + actionInvisible->setIcon( KIcon( protocol()->statusManager()->onlineStatusOf( pres ).iconFor( this ) ) ); + actionInvisible->setChecked( (presence().flags() & Oscar::Presence::Invisible) == Oscar::Presence::Invisible ); QObject::connect( actionInvisible, SIGNAL(triggered(bool)), this, SLOT(slotToggleInvisible()) ); mActionMenu->addAction( actionInvisible ); return mActionMenu; } -void AIMAccount::setPresenceFlags( AIM::Presence::Flags flags, const QString &message ) +void AIMAccount::setPresenceFlags( Oscar::Presence::Flags flags, const QString &message ) { - AIM::Presence pres = presence(); + Oscar::Presence pres = presence(); kDebug(OSCAR_AIM_DEBUG) << k_funcinfo << "new flags=" << (int)flags << ", old type=" << (int)pres.flags() << ", new message=" << message << endl; - setPresenceTarget( AIM::Presence( pres.type(), flags ), message ); + setPresenceTarget( Oscar::Presence( pres.type(), flags ), message ); } -void AIMAccount::setPresenceType( AIM::Presence::Type type, const QString &message ) +void AIMAccount::setPresenceType( Oscar::Presence::Type type, const QString &message ) { - AIM::Presence pres = presence(); + Oscar::Presence pres = presence(); kDebug(OSCAR_AIM_DEBUG) << k_funcinfo << "new type=" << (int)type << ", old type=" << (int)pres.type() << ", new message=" << message << endl; - setPresenceTarget( AIM::Presence( type, pres.flags() ), message ); + setPresenceTarget( Oscar::Presence( type, pres.flags() ), message ); } -void AIMAccount::setPresenceTarget( const AIM::Presence &newPres, const QString &message ) +void AIMAccount::setPresenceTarget( const Oscar::Presence &newPres, const QString &message ) { - bool targetIsOffline = (newPres.type() == AIM::Presence::Offline); - bool accountIsOffline = ( presence().type() == AIM::Presence::Offline || + bool targetIsOffline = (newPres.type() == Oscar::Presence::Offline); + bool accountIsOffline = ( presence().type() == Oscar::Presence::Offline || myself()->onlineStatus() == protocol()->statusManager()->connectingStatus() ); if ( targetIsOffline ) { OscarAccount::disconnect(); // allow toggling invisibility when offline - myself()->setOnlineStatus( newPres.toOnlineStatus() ); + myself()->setOnlineStatus( protocol()->statusManager()->onlineStatusOf( newPres ) ); } else if ( accountIsOffline ) { mInitialStatusMessage = message; - OscarAccount::connect( newPres.toOnlineStatus() ); + OscarAccount::connect( protocol()->statusManager()->onlineStatusOf( newPres ) ); } else { - engine()->setStatus( newPres.toOscarStatus(), message ); + engine()->setStatus( protocol()->statusManager()->oscarStatusOf( newPres ), message ); } } @@ -337,20 +342,20 @@ void AIMAccount::setOnlineStatus( const Kopete::OnlineStatus& status, const Kope { // called from outside, i.e. not by our custom action menu entry... - if ( presence().type() == AIM::Presence::Offline ) + if ( presence().type() == Oscar::Presence::Offline ) { // ...when we are offline go online invisible. - setPresenceTarget( AIM::Presence( AIM::Presence::Online, AIM::Presence::Invisible ) ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Online, Oscar::Presence::Invisible ) ); } else { // ...when we are not offline set invisible. - setPresenceFlags( AIM::Presence::Invisible ); + setPresenceFlags( Oscar::Presence::Invisible ); } } else { - setPresenceType( AIM::Presence::fromOnlineStatus( status ).type(), reason.message() ); + setPresenceType( protocol()->statusManager()->presenceOf( status ).type(), reason.message() ); } } @@ -443,7 +448,8 @@ void AIMAccount::loginActions() void AIMAccount::disconnected( DisconnectReason reason ) { kDebug( OSCAR_AIM_DEBUG ) << k_funcinfo << "Attempting to set status offline" << endl; - myself()->setOnlineStatus( AIM::Presence( AIM::Presence::Offline, presence().flags() ).toOnlineStatus() ); + Oscar::Presence pres( Oscar::Presence::Offline, presence().flags() ); + myself()->setOnlineStatus( protocol()->statusManager()->onlineStatusOf( pres ) ); QHash contactList = contacts(); foreach( Kopete::Contact* c, contactList.values() ) @@ -572,7 +578,8 @@ void AIMAccount::userJoinedChat( Oscar::WORD exchange, const QString& room, cons } kDebug(OSCAR_AIM_DEBUG) << k_funcinfo << "adding contact" << endl; - session->addContact( c, AIM::Presence( AIM::Presence::Online ).toOnlineStatus(), true /* suppress */ ); + Kopete::OnlineStatus status = protocol()->statusManager()->onlineStatusOf( Oscar::Presence( Oscar::Presence::Online ) ); + session->addContact( c, status, true /* suppress */ ); } } } @@ -625,8 +632,8 @@ void AIMAccount::connectWithPassword( const QString &password ) //use default online in case of invalid online status for connecting status = Kopete::OnlineStatus( Kopete::OnlineStatus::Online ); - AIM::Presence pres = AIM::Presence::fromOnlineStatus( status ); - bool accountIsOffline = ( presence().type() == AIM::Presence::Offline || + Oscar::Presence pres = protocol()->statusManager()->presenceOf( status ); + bool accountIsOffline = ( presence().type() == Oscar::Presence::Offline || myself()->onlineStatus() == protocol()->statusManager()->connectingStatus() ); if ( accountIsOffline ) @@ -647,7 +654,7 @@ void AIMAccount::connectWithPassword( const QString &password ) oscarSettings->setLastPort( configGroup()->readEntry( "LastPort", 5199 ) ); oscarSettings->setTimeout( configGroup()->readEntry( "Timeout", 10 ) ); - Oscar::DWORD status = pres.toOscarStatus(); + Oscar::DWORD status = protocol()->statusManager()->oscarStatusOf( pres ); engine()->setStatus( status, mInitialStatusMessage ); updateVersionUpdaterStamp(); engine()->start( server, port, accountId(), password.left(16) ); diff --git a/kopete/protocols/oscar/aim/aimaccount.h b/kopete/protocols/oscar/aim/aimaccount.h index 1ea852830..8df35952c 100644 --- a/kopete/protocols/oscar/aim/aimaccount.h +++ b/kopete/protocols/oscar/aim/aimaccount.h @@ -3,7 +3,7 @@ Copyright (c) 2002 by Chris TenHarmsel - Kopete (c) 2002 by the Kopete developers + Kopete (c) 2002-2007 by the Kopete developers ************************************************************************* * * @@ -25,8 +25,7 @@ #include "oscaraccount.h" #include "oscarmyselfcontact.h" - -#include "aimpresence.h" +#include "oscarpresence.h" namespace AIM { @@ -128,11 +127,11 @@ protected: OscarContact *createNewContact( const QString &contactId, Kopete::MetaContact *parentContact, const OContact& ssiItem ); private: - AIM::Presence presence(); + Oscar::Presence presence(); - void setPresenceFlags( AIM::Presence::Flags flags, const QString &message = QString::null ); - void setPresenceType( AIM::Presence::Type, const QString &awayMessage = QString::null ); - void setPresenceTarget( const AIM::Presence &presence, const QString &message = QString::null ); + void setPresenceFlags( Oscar::Presence::Flags flags, const QString &message = QString::null ); + void setPresenceType( Oscar::Presence::Type, const QString &awayMessage = QString::null ); + void setPresenceTarget( const Oscar::Presence &presence, const QString &message = QString::null ); // Set privacy tlv item void setPrivacyTLVs( Oscar::BYTE privacy, Oscar::DWORD userClasses ); diff --git a/kopete/protocols/oscar/aim/aimcontact.cpp b/kopete/protocols/oscar/aim/aimcontact.cpp index d6fd1e3f9..d43f9f7e0 100644 --- a/kopete/protocols/oscar/aim/aimcontact.cpp +++ b/kopete/protocols/oscar/aim/aimcontact.cpp @@ -2,8 +2,8 @@ aimcontact.cpp - Oscar Protocol Plugin Copyright (c) 2003 by Will Stephenson - Copyright (c) 2006 by Roman Jarosz - Kopete (c) 2002-2006 by the Kopete developers + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers ************************************************************************* * * @@ -30,13 +30,14 @@ #include "aimprotocol.h" #include "aimuserinfo.h" #include "aimaccount.h" +#include "oscarstatusmanager.h" AIMContact::AIMContact( Kopete::Account* account, const QString& name, Kopete::MetaContact* parent, const QString& icon, const OContact& ssiItem ) : AIMContactBase(account, name, parent, icon, ssiItem ) { mProtocol=static_cast(protocol()); - setOnlineStatus( AIM::Presence( AIM::Presence::Offline ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline ) ); m_infoDialog = 0L; m_warnUserAction = 0L; @@ -108,7 +109,7 @@ void AIMContact::updateSSIItem() onlineStatus() == Kopete::OnlineStatus::Unknown ) { //make sure they're offline - setOnlineStatus( AIM::Presence( AIM::Presence::Offline ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline ) ); } } @@ -145,12 +146,12 @@ void AIMContact::userInfoUpdated( const QString& contact, const UserDetails& det setNickName( contact ); kDebug( OSCAR_AIM_DEBUG ) << k_funcinfo << "extendedStatus is " << details.extendedStatus() << endl; - AIM::Presence presence = AIM::Presence::fromOscarStatus( details.extendedStatus(), details.userClass() ); - setOnlineStatus( presence.toOnlineStatus() ); + Oscar::Presence presence = mProtocol->statusManager()->presenceOf( details.extendedStatus(), details.userClass() ); + setPresenceTarget( presence ); - m_mobile = ( presence.flags() & AIM::Presence::Wireless ); + m_mobile = ( presence.flags() & Oscar::Presence::Wireless ); - if ( presence.type() == AIM::Presence::Online ) + if ( presence.type() == Oscar::Presence::Online ) { removeProperty( mProtocol->awayMessage ); m_haveAwayMessage = false; @@ -172,7 +173,7 @@ void AIMContact::userOnline( const QString& userId ) if ( Oscar::normalize( userId ) == Oscar::normalize( contactId() ) ) { kDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Getting more contact info" << endl; - setOnlineStatus( AIM::Presence( AIM::Presence::Online ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Online ) ); } } @@ -181,7 +182,7 @@ void AIMContact::userOffline( const QString& userId ) if ( Oscar::normalize( userId ) == Oscar::normalize( contactId() ) ) { kDebug(OSCAR_AIM_DEBUG) << "Setting " << userId << " offline" << endl; - setOnlineStatus( AIM::Presence( AIM::Presence::Offline ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline ) ); removeProperty( mProtocol->awayMessage ); } } diff --git a/kopete/protocols/oscar/aim/aimpresence.cpp b/kopete/protocols/oscar/aim/aimpresence.cpp deleted file mode 100644 index 7dc04f03c..000000000 --- a/kopete/protocols/oscar/aim/aimpresence.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/* - aimpresence.cpp - AIM online status and presence management - - Copyright (c) 2004 by Richard Smith - Copyright (c) 2006 by Roman Jarosz - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ************************************************************************* -*/ - -#include -#include - -#include -#include -#include - -#include -#include - -#include "aimprotocol.h" - -#include "aimpresence.h" - -namespace AIM -{ - -//BEGIN class PresenceOverlay - -class PresenceOverlay -{ -public: - PresenceOverlay() : mFlags( Presence::None ) {} - PresenceOverlay( Presence::Flags flags, QString name, QStringList icons ) - : mFlags(flags), mName(name), mIcons(icons) {} - - static PresenceOverlay createForFlags( Presence::Flags flags ); - - Presence::Flags overlayFlag() const { return mFlags; } - QString overlayName() const { return mName; } - QStringList overlayIcons() const { return mIcons; } - - PresenceOverlay &operator+= ( const PresenceOverlay &other ); - -private: - Presence::Flags mFlags; - QString mName; - QStringList mIcons; -}; - -PresenceOverlay PresenceOverlay::createForFlags( Presence::Flags flags ) -{ - /** - * Here are defined all available overlays. We can define overlay for one Presence::Flags - * or for combination of Presence::Flags. If a flags argument in this function is combination - * of flags than a PresenceOverlay object is created from combination of defined overlays or - * if the combination is defined separately than we return that PresenceOverlay object. - */ - - const int dataSize = 3; - static const PresenceOverlay data[dataSize] = - { - PresenceOverlay( Presence::Invisible, i18n("Invisible"), QStringList(QString("contact_invisible_overlay")) ), - PresenceOverlay( Presence::Wireless, i18n("Mobile"), QStringList(QString("contact_phone_overlay")) ), - PresenceOverlay( Presence::ICQ, i18n("ICQ"), QStringList(QString("icq_overlay")) ) - }; - - PresenceOverlay overlay; - for ( int n = 0; n < dataSize; ++n ) - { - if ( data[n].overlayFlag() == flags ) - return data[n]; - else if ( data[n].overlayFlag() & flags ) - overlay += data[n]; - } - - return overlay; -} - -PresenceOverlay &PresenceOverlay::operator+=( const PresenceOverlay &other ) -{ - mFlags |= other.mFlags; - if ( mName.isEmpty() ) - mName = other.mName; - else if ( !other.mName.isEmpty() ) - mName += QString( ", " ) + other.mName; - - mIcons << other.mIcons; - return *this; -} - -//END class PresenceOverlay - - -//BEGIN struct PresenceTypeData - -typedef QList FlagsList; -struct PresenceTypeData -{ - Presence::Type type; - Kopete::OnlineStatus::StatusType onlineStatusType; - unsigned long setFlag; - unsigned long getFlag; - QString caption; - QString name; - QStringList overlayIcons; - Kopete::OnlineStatusManager::Categories categories; - Kopete::OnlineStatusManager::Options options; - FlagsList overlayFlagsList; - - static const PresenceTypeData *all(); - static const PresenceTypeData &forType( Presence::Type type ); - static const PresenceTypeData &forStatus( unsigned long status ); - static const PresenceTypeData &forOnlineStatusType( const Kopete::OnlineStatus::StatusType statusType ); -}; - -const PresenceTypeData *PresenceTypeData::all() -{ - using namespace Kopete; - using namespace AIM::StatusCode; - /** - * The order here is important - this is the order the IS_XXX flags will be checked for in. - * That, in particular, means that NA, Occupied and DND must appear before Away, and that - * DND must appear before Occupied. Offline (testing all bits) must go first, and Online - * (testing no bits - will always match a status) must go last. - * - * Free For Chat is currently listed after Away, since if someone is Away + Free For Chat we - * want to show them as Away more than we want to show them FFC. - * - * OverlayFlagsList should contain all possible flags combinations that can occur in AIM protocol. - * If overlayFlagsList contains flag None than this KOS will be in account's context menu. - */ - static const PresenceTypeData data[] = - { - { Presence::Offline, OnlineStatus::Offline, OFFLINE, OFFLINE, i18n( "O&ffline" ), i18n("Offline"), QStringList(), Kopete::OnlineStatusManager::Offline, 0, FlagsList() << Presence::None << Presence::ICQ << Presence::Invisible }, - - { Presence::DoNotDisturb, OnlineStatus::Away, SET_DND, IS_DND, i18n( "&Do Not Disturb" ), i18n("Do Not Disturb"), QStringList(QString("contact_busy_overlay")), Kopete::OnlineStatusManager::Busy, Kopete::OnlineStatusManager::HasStatusMessage, FlagsList() << Presence::ICQ << (Presence::ICQ | Presence::Invisible) }, - - { Presence::Occupied, OnlineStatus::Away, SET_OCC, IS_OCC, i18n( "O&ccupied" ), i18n("Occupied"), QStringList(QString("contact_busy_overlay")), 0, Kopete::OnlineStatusManager::HasStatusMessage, FlagsList() << Presence::ICQ << (Presence::ICQ | Presence::Invisible) }, - - { Presence::NotAvailable, OnlineStatus::Away, SET_NA, IS_NA, i18n( "Not A&vailable" ), i18n("Not Available"), QStringList(QString("contact_xa_overlay")), Kopete::OnlineStatusManager::ExtendedAway, Kopete::OnlineStatusManager::HasStatusMessage, FlagsList() << Presence::ICQ << (Presence::ICQ | Presence::Invisible) }, - - { Presence::Away, OnlineStatus::Away, SET_AWAY, IS_AWAY, i18n( "&Away" ), i18n("Away"), QStringList(QString("contact_away_overlay")), Kopete::OnlineStatusManager::Away, Kopete::OnlineStatusManager::HasStatusMessage, FlagsList() << Presence::None << Presence::Invisible << Presence::ICQ << (Presence::ICQ | Presence::Invisible) << Presence::Wireless << (Presence::Wireless | Presence::Invisible) }, - - { Presence::FreeForChat, OnlineStatus::Online, SET_FFC, IS_FFC, i18n( "&Free for Chat" ), i18n("Free For Chat"), QStringList(QString("icq_ffc")), Kopete::OnlineStatusManager::FreeForChat, 0, FlagsList() << Presence::ICQ << (Presence::ICQ | Presence::Invisible) }, - - { Presence::Online, OnlineStatus::Online, ONLINE, ONLINE, i18n( "O&nline" ), i18n("Online"), QStringList(), Kopete::OnlineStatusManager::Online, 0, FlagsList() << Presence::None << Presence::Invisible << Presence::ICQ << (Presence::ICQ | Presence::Invisible) << Presence::Wireless << (Presence::Wireless | Presence::Invisible) } - }; - return data; -} - -const PresenceTypeData &PresenceTypeData::forType( Presence::Type type ) -{ - const PresenceTypeData *array = all(); - for ( uint n = 0; n < Presence::TypeCount; ++n ) - if ( array[n].type == type ) - return array[n]; - kWarning(14153) << k_funcinfo << "type " << (int)type << " not found! Returning Offline" << endl; - return array[0]; -} - -const PresenceTypeData &PresenceTypeData::forStatus( unsigned long status ) -{ - const PresenceTypeData *array = all(); - for ( uint n = 0; n < Presence::TypeCount; ++n ) - { - if ( (array[n].getFlag & status) == array[n].getFlag ) - return array[n]; - } - kWarning(14153) << k_funcinfo << "status " << (int)status << " not found! Returning Offline. This should not happen." << endl; - return array[0]; -} - -const PresenceTypeData &PresenceTypeData::forOnlineStatusType( const Kopete::OnlineStatus::StatusType statusType ) -{ - const PresenceTypeData *array = all(); - for ( int n = Presence::TypeCount - 1; n >= 0; --n ) - { - if ( array[n].onlineStatusType == statusType ) - return array[n]; - } - kWarning(14153) << k_funcinfo << "online status " << (int)statusType << " not found! Returning Offline. This should not happen." << endl; - return array[0]; -} - -//END struct PresenceTypeData - -//BEGIN class OnlineStatusManager - -class OnlineStatusManager::Private -{ -public: - typedef QHash StatusHash; - - // connecting and unknown should have the same internal status as offline, so converting to a Presence gives an Offline one - Private() - : connecting( Kopete::OnlineStatus::Connecting, 99, AIMProtocol::protocol(), - 99, QStringList(QString("aim_connecting")), i18n("Connecting...") ) - , unknown( Kopete::OnlineStatus::Unknown, 0, AIMProtocol::protocol(), - Presence::Offline, QStringList(QString("status_unknown")), i18n("Unknown") ) - , waitingForAuth( Kopete::OnlineStatus::Unknown, 1, AIMProtocol::protocol(), - Presence::Offline, QStringList(QString("button_cancel")), i18n("Waiting for Authorization") ) - , invisible( Kopete::OnlineStatus::Invisible, 2, AIMProtocol::protocol(), - Presence::Offline, QStringList(), QString(), - QString(), Kopete::OnlineStatusManager::Invisible, - Kopete::OnlineStatusManager::HideFromMenu ) - - { - //weight 0, 1 and 2 are used by KOS unknown, waitingForAuth and invisible - const uint firstUsableWeight = 3; - for ( uint i = 0; i < Presence::TypeCount; ++i ) - { - const PresenceTypeData &data = PresenceTypeData::forType( static_cast(i) ); - const uint weight = i + firstUsableWeight; - for ( int j = 0; j < data.overlayFlagsList.count(); ++j ) - { - const uint internalStatus = data.overlayFlagsList.at(j) | data.type; - - Kopete::OnlineStatus status; - if ( data.overlayFlagsList.at(j) != Presence::None ) - { - PresenceOverlay overlay = PresenceOverlay::createForFlags( data.overlayFlagsList.at(j) ); - //don't add KOS to account's context menu - status = Kopete::OnlineStatus( data.onlineStatusType, weight, - AIMProtocol::protocol(), internalStatus, - data.overlayIcons + overlay.overlayIcons(), - data.name + QString(" (%1)").arg( overlay.overlayName() ) ); - } - else - { - //add KOS - status = Kopete::OnlineStatus( data.onlineStatusType, weight, - AIMProtocol::protocol(), internalStatus, - data.overlayIcons, data.name, - data.caption, data.categories, data.options ); - } - statusHash[internalStatus] = status; - } - } - } - - StatusHash statusHash; - Kopete::OnlineStatus connecting; - Kopete::OnlineStatus unknown; - Kopete::OnlineStatus waitingForAuth; - Kopete::OnlineStatus invisible; -}; - -OnlineStatusManager::OnlineStatusManager() - : d( new Private ) -{ -} - -OnlineStatusManager::~OnlineStatusManager() -{ - delete d; -} - -Kopete::OnlineStatus OnlineStatusManager::onlineStatusOf( const Presence &presence ) -{ - if ( d->statusHash.contains( presence.internalStatus() ) ) - { - return d->statusHash.value( presence.internalStatus() ); - } - else if ( d->statusHash.contains( presence.type() ) ) - { - kWarning() << k_funcinfo << "Kopete::OnlineStatus doesn't exists for internal status" << presence.internalStatus() - << "Using basic status for type" << presence.type() << endl; - return d->statusHash.value( presence.type() ); - } - else - { - kWarning() << k_funcinfo << "Kopete::OnlineStatus doesn't exists for internal status" << presence.internalStatus() << endl; - return d->unknown; - } -} - -Kopete::OnlineStatus OnlineStatusManager::connectingStatus() -{ - return d->connecting; -} - -Kopete::OnlineStatus OnlineStatusManager::unknownStatus() -{ - return d->unknown; -} - -Kopete::OnlineStatus OnlineStatusManager::waitingForAuth() -{ - return d->waitingForAuth; -} - -//END class OnlineStatusManager - -//BEGIN class Presence - -Presence::Presence( Type type, Flags flags ) -{ - _internalStatus = type | flags; -} - -Presence::Presence( uint internalStatus ) -{ - _internalStatus = internalStatus; -} - -Presence Presence::fromOnlineStatus( const Kopete::OnlineStatus &status ) -{ - if ( status.protocol() == AIMProtocol::protocol() ) - { - return Presence( status.internalStatus() ); - } - else - { - //status is a libkopete builtin status object - //don't even think about converting it to AIM::Presence using presenceOf! - return Presence( PresenceTypeData::forOnlineStatusType( status.status() ).type, - Presence::None ); - } -} - -Kopete::OnlineStatus Presence::toOnlineStatus() const -{ - OnlineStatusManager *store = AIMProtocol::protocol()->statusManager(); - return store->onlineStatusOf( *this ); -} - - -unsigned long Presence::toOscarStatus() const -{ - unsigned long basicStatus = basicOscarStatus(); - if ( (_internalStatus & Invisible) == Invisible ) - basicStatus |= StatusCode::INVISIBLE; - return basicStatus; -} - -Presence Presence::fromOscarStatus( unsigned long oStatus, int oClass ) -{ - Type type = typeFromOscarStatus( oStatus ); - - //Hack for aim away contacts - if ( type == Online && (oClass & ClassCode::AWAY) == ClassCode::AWAY ) - type = Away; - - Flags flags = None; - if ( ( oClass & ClassCode::ICQ) == ClassCode::ICQ ) - flags |= ICQ; - - if ( ( oClass & ClassCode::WIRELESS) == ClassCode::WIRELESS ) - flags |= Wireless; - - if ( ( oStatus & StatusCode::INVISIBLE) == StatusCode::INVISIBLE ) - flags |= Invisible; - - return Presence( type, flags ); -} - -unsigned long Presence::basicOscarStatus() const -{ - const PresenceTypeData &data = PresenceTypeData::forType( type() ); - return data.setFlag; -} - -Presence::Type Presence::typeFromOscarStatus( unsigned long status ) -{ - const PresenceTypeData &data = PresenceTypeData::forStatus( status & 0xff ); - return data.type; -} - -//END class Presence - -} // end namespace AIM diff --git a/kopete/protocols/oscar/aim/aimpresence.h b/kopete/protocols/oscar/aim/aimpresence.h deleted file mode 100644 index 549090172..000000000 --- a/kopete/protocols/oscar/aim/aimpresence.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - aimpresence.h - AIM online status and presence management - - Copyright (c) 2004 by Richard Smith - Copyright (c) 2006 by Roman Jarosz - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ************************************************************************* -*/ - - -#ifndef AIMPRESENCE_H -#define AIMPRESENCE_H - -#include - -namespace Kopete { class OnlineStatus; } - -namespace AIM -{ - -class Presence; - -/** - * @brief This namespace contains status flags used in OSCAR's on-the-wire format. - * - * The IS_XXX values are bits representing actual status flags. However, the flags - * are just that -- flags. AIM statuses are represented by a combination of these - * flags rather than just one value. This seems to be for backwards compatibility - * reasons -- this way you can add a new status and existing clients should still - * work correctly. - * - * So, when changing status you need to specify not only what status it is, but - * also all other status flags that are appropriate. The SET_XXX flags do just that; - * SET_DND for instance sets the DND, Occupied and Away bits. - */ -namespace StatusCode -{ - enum - { - OFFLINE = 0xFFFFFFFF, - ONLINE = 0x00000000, - INVISIBLE = 0x00000100, - - IS_DND = 0x00000002, ///< Do Not Disturb - IS_OCC = 0x00000010, ///< Occupied - IS_NA = 0x00000004, ///< Not Available - IS_AWAY = 0x00000001, ///< Away - IS_FFC = 0x00000020, ///< Free For Chat - - SET_DND = 0x00000013, //== DND + Occupied + Away - SET_OCC = 0x00000011, //== Occupied + Away - SET_NA = 0x00000005, //== NA + Away - SET_AWAY = 0x00000001, - SET_FFC = 0x00000020, - - WEBAWARE = 0x00010000, - SHOWIP = 0x00020000 - }; -} // end namespace StatusCode - -namespace ClassCode -{ - enum - { - AWAY = 0x0020, - ICQ = 0x0040, - WIRELESS = 0x0080 - }; -} // end namespace ClassCode - -/** - * @brief A manager for AIM's online statuses - * - * Looks after AIM's numerous online statuses, and maps between them and Presence objects. - * A single instance of this class is held by the AIMProtocol object. - */ -class OnlineStatusManager -{ -public: - OnlineStatusManager(); - ~OnlineStatusManager(); - - Kopete::OnlineStatus onlineStatusOf( const AIM::Presence &presence ); - Kopete::OnlineStatus connectingStatus(); - Kopete::OnlineStatus unknownStatus(); - Kopete::OnlineStatus waitingForAuth(); - -private: - class Private; - Private *d; -}; - -/** - * @brief An AIM online presence object - */ -class Presence -{ -public: - /** - * Friendly types this status can be - */ - enum Type { Offline = 0x000, DoNotDisturb = 0x001, Occupied = 0x002, - NotAvailable = 0x003, Away = 0x004, FreeForChat = 0x005, Online = 0x006 }; - enum { TypeCount = Online + 1 }; - - enum Flag { None = 0x000, ICQ = 0x010, Wireless = 0x100, Invisible = 0x200 }; - Q_DECLARE_FLAGS(Flags, Flag) - - Presence( Type type, Flags flags = None ); - - Type type() const { return (Type)(_internalStatus & 0x0000000F); } - Flags flags() const { return (Flags)(_internalStatus & 0xFFFFFFF0); } - uint internalStatus() const { return _internalStatus; } - - /** - * Generate a Presence object from an online status - */ - static Presence fromOnlineStatus( const Kopete::OnlineStatus &status ); - - /** - * Convert this Presence object to an online status - */ - Kopete::OnlineStatus toOnlineStatus() const; - - /** - * Get the status code to pass to liboscar to set us to this Status. - * @note This is not the opposite of fromOnlineStatus(). The set and get codes don't match. - */ - unsigned long toOscarStatus() const; - - /** - * Get the status a contact is at based on liboscar's view of its status. - * @note This is not the opposite of toOnlineStatus(). - */ - static Presence fromOscarStatus( unsigned long oStatus, int oClass ); - - bool operator==( const Presence &other ) const { return other._internalStatus == _internalStatus; } - bool operator!=( const Presence &other ) const { return !(*this == other); } - -private: - Presence( uint internalStatus ); - - unsigned long basicOscarStatus() const; - static Type typeFromOscarStatus( unsigned long status ); -private: - uint _internalStatus; - -}; -Q_DECLARE_OPERATORS_FOR_FLAGS(Presence::Flags) -} - -#endif diff --git a/kopete/protocols/oscar/aim/aimprotocol.cpp b/kopete/protocols/oscar/aim/aimprotocol.cpp index a8fa450b9..97c383851 100644 --- a/kopete/protocols/oscar/aim/aimprotocol.cpp +++ b/kopete/protocols/oscar/aim/aimprotocol.cpp @@ -19,7 +19,7 @@ #include "aimprotocol.h" #include "aimaccount.h" -#include "aimpresence.h" +#include "aimstatusmanager.h" #include "aimaddcontactpage.h" #include "aimeditaccountwidget.h" @@ -225,7 +225,7 @@ AIMProtocol::AIMProtocol(QObject *parent, const QStringList &) protocolStatic_ = this; // must be done after protocolStatic_ is set... - statusManager_ = new AIM::OnlineStatusManager; + statusManager_ = new AIMStatusManager; setCapabilities( Kopete::Protocol::FullRTF ); // setting capabilities kDebug(14152) << k_funcinfo << "capabilities set to FullRTF" << endl; @@ -259,7 +259,7 @@ Kopete::Account *AIMProtocol::createNewAccount(const QString &accountId) return ( new AIMAccount( this, accountId ) ); } -AIM::OnlineStatusManager *AIMProtocol::statusManager() +OscarStatusManager *AIMProtocol::statusManager() const { return statusManager_; } diff --git a/kopete/protocols/oscar/aim/aimprotocol.h b/kopete/protocols/oscar/aim/aimprotocol.h index fa72f1e73..6d714308b 100644 --- a/kopete/protocols/oscar/aim/aimprotocol.h +++ b/kopete/protocols/oscar/aim/aimprotocol.h @@ -27,7 +27,7 @@ namespace Kopete class OnlineStatus; } -namespace AIM { class OnlineStatusManager; } +class AIMStatusManager; class AIMProtocolHandler : public Kopete::MimeTypeHandler { @@ -55,14 +55,14 @@ public: KopeteEditAccountWidget* createEditAccountWidget( Kopete::Account *account, QWidget *parent ); Kopete::Account* createNewAccount( const QString &accountId ); - AIM::OnlineStatusManager *statusManager(); + OscarStatusManager *statusManager() const; const Kopete::ContactPropertyTmpl clientProfile; private: /** The active instance of oscarprotocol */ static AIMProtocol *protocolStatic_; - AIM::OnlineStatusManager* statusManager_; + AIMStatusManager* statusManager_; AIMProtocolHandler protohandler; }; diff --git a/kopete/protocols/oscar/aim/aimstatusmanager.cpp b/kopete/protocols/oscar/aim/aimstatusmanager.cpp new file mode 100644 index 000000000..694f34b93 --- /dev/null +++ b/kopete/protocols/oscar/aim/aimstatusmanager.cpp @@ -0,0 +1,114 @@ +/* + aimstatusmanager.cpp - AIM Status Manager + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include "aimstatusmanager.h" + +#include + +#include "aimprotocol.h" +#include "oscarpresencesdataclasses.h" + +class AIMStatusManager::Private +{ +public: + // connecting and unknown should have the same internal status as offline, so converting to a Presence gives an Offline one + Private() + : connecting( Kopete::OnlineStatus::Connecting, 99, AIMProtocol::protocol(), + 99, QStringList(QString("aim_connecting")), i18n("Connecting...") ) + , unknown( Kopete::OnlineStatus::Unknown, 0, AIMProtocol::protocol(), + Oscar::Presence::Offline, QStringList(QString("status_unknown")), i18n("Unknown") ) + , waitingForAuth( Kopete::OnlineStatus::Unknown, 1, AIMProtocol::protocol(), + Oscar::Presence::Offline, QStringList(QString("button_cancel")), i18n("Waiting for Authorization") ) + , invisible( Kopete::OnlineStatus::Invisible, 2, AIMProtocol::protocol(), + Oscar::Presence::Offline, QStringList(), QString(), + QString(), Kopete::OnlineStatusManager::Invisible, + Kopete::OnlineStatusManager::HideFromMenu ) + {} + + Kopete::OnlineStatus connecting; + Kopete::OnlineStatus unknown; + Kopete::OnlineStatus waitingForAuth; + Kopete::OnlineStatus invisible; +}; + +AIMStatusManager::AIMStatusManager() + : OscarStatusManager( AIMProtocol::protocol() ), d( new Private ) +{ + using namespace Oscar; + using namespace Kopete; + using namespace StatusCode; + + /** + * The order here is important - this is the order the IS_XXX flags will be checked for in. + * That, in particular, means that NA, Occupied and DND must appear before Away, and that + * DND must appear before Occupied. Offline (testing all bits) must go first, and Online + * (testing no bits - will always match a status) must go last. + * + * Free For Chat is currently listed after Away, since if someone is Away + Free For Chat we + * want to show them as Away more than we want to show them FFC. + */ + + QList data; + + data << PresenceType( Presence::Offline, OnlineStatus::Offline, OFFLINE, OFFLINE, i18n( "O&ffline" ), i18n("Offline"), QStringList(), Kopete::OnlineStatusManager::Offline, 0, PresenceType::FlagsList() << Presence::None << Presence::ICQ << Presence::Invisible ); + + data << PresenceType( Presence::DoNotDisturb, OnlineStatus::Away, SET_DND, IS_DND, i18n( "&Do Not Disturb" ), i18n("Do Not Disturb"), QStringList(QString("contact_busy_overlay")), Kopete::OnlineStatusManager::Busy, Kopete::OnlineStatusManager::HasStatusMessage, PresenceType::FlagsList() << Presence::ICQ << (Presence::ICQ | Presence::Invisible) ); + + data << PresenceType( Presence::Occupied, OnlineStatus::Away, SET_OCC, IS_OCC, i18n( "O&ccupied" ), i18n("Occupied"), QStringList(QString("contact_busy_overlay")), 0, Kopete::OnlineStatusManager::HasStatusMessage, PresenceType::FlagsList() << Presence::ICQ << (Presence::ICQ | Presence::Invisible) ); + + data << PresenceType( Presence::NotAvailable, OnlineStatus::Away, SET_NA, IS_NA, i18n( "Not A&vailable" ), i18n("Not Available"), QStringList(QString("contact_xa_overlay")), Kopete::OnlineStatusManager::ExtendedAway, Kopete::OnlineStatusManager::HasStatusMessage, PresenceType::FlagsList() << Presence::ICQ << (Presence::ICQ | Presence::Invisible) ); + + data << PresenceType( Presence::Away, OnlineStatus::Away, SET_AWAY, IS_AWAY, i18n( "&Away" ), i18n("Away"), QStringList(QString("contact_away_overlay")), Kopete::OnlineStatusManager::Away, Kopete::OnlineStatusManager::HasStatusMessage, PresenceType::FlagsList() << Presence::None << Presence::Invisible << Presence::ICQ << (Presence::ICQ | Presence::Invisible) << Presence::Wireless << (Presence::Wireless | Presence::Invisible) ); + + data << PresenceType( Presence::FreeForChat, OnlineStatus::Online, SET_FFC, IS_FFC, i18n( "&Free for Chat" ), i18n("Free For Chat"), QStringList(QString("icq_ffc")), Kopete::OnlineStatusManager::FreeForChat, 0, PresenceType::FlagsList() << Presence::ICQ << (Presence::ICQ | Presence::Invisible) ); + + data << PresenceType( Presence::Online, OnlineStatus::Online, ONLINE, ONLINE, i18n( "O&nline" ), i18n("Online"), QStringList(), Kopete::OnlineStatusManager::Online, 0, PresenceType::FlagsList() << Presence::None << Presence::Invisible << Presence::ICQ << (Presence::ICQ | Presence::Invisible) << Presence::Wireless << (Presence::Wireless | Presence::Invisible) ); + + setPresenceType( data ); + + QList overlay; + + overlay << PresenceOverlay( Presence::Invisible, i18n("Invisible"), QStringList(QString("contact_invisible_overlay")) ); + overlay << PresenceOverlay( Presence::Wireless, i18n("Mobile"), QStringList(QString("contact_phone_overlay")) ); + overlay << PresenceOverlay( Presence::ICQ, i18n("ICQ"), QStringList(QString("icq_overlay")) ); + + setPresenceOverlay( overlay ); + + setPresenceFlagsMask( ~(Presence::Flags)Presence::AIM ); + //weight 0, 1 and 2 are used by KOS unknown, waitingForAuth and invisible + initialize( 3 ); +} + +AIMStatusManager::~AIMStatusManager() +{ + delete d; +} + +Kopete::OnlineStatus AIMStatusManager::connectingStatus() const +{ + return d->connecting; +} + +Kopete::OnlineStatus AIMStatusManager::unknownStatus() const +{ + return d->unknown; +} + +Kopete::OnlineStatus AIMStatusManager::waitingForAuth() const +{ + return d->waitingForAuth; +} diff --git a/kopete/protocols/oscar/aim/aimstatusmanager.h b/kopete/protocols/oscar/aim/aimstatusmanager.h new file mode 100644 index 000000000..782bbd084 --- /dev/null +++ b/kopete/protocols/oscar/aim/aimstatusmanager.h @@ -0,0 +1,41 @@ +/* + aimstatusmanager.h - AIM Status Manager + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + + +#ifndef AIMSTATUSMANAGER_H +#define AIMSTATUSMANAGER_H + +#include "oscarstatusmanager.h" + +namespace Kopete { class OnlineStatus; } + +class AIMStatusManager : public OscarStatusManager +{ +public: + AIMStatusManager(); + ~AIMStatusManager(); + + virtual Kopete::OnlineStatus connectingStatus() const; + virtual Kopete::OnlineStatus unknownStatus() const; + virtual Kopete::OnlineStatus waitingForAuth() const; + +private: + class Private; + Private *d; +}; + +#endif diff --git a/kopete/protocols/oscar/aim/icqcontact.cpp b/kopete/protocols/oscar/aim/icqcontact.cpp index 0c0aba004..aa49b6985 100644 --- a/kopete/protocols/oscar/aim/icqcontact.cpp +++ b/kopete/protocols/oscar/aim/icqcontact.cpp @@ -3,9 +3,9 @@ Copyright (c) 2003 by Stefan Gehn Copyright (c) 2003 by Olivier Goffart - Copyright (c) 2006 by Roman Jarosz + Copyright (c) 2006,2007 by Roman Jarosz - Kopete (c) 2003-2006 by the Kopete developers + Kopete (c) 2003-2007 by the Kopete developers ************************************************************************* * * @@ -32,6 +32,7 @@ #include "oscarutils.h" #include "contactmanager.h" +#include "oscarstatusmanager.h" ICQContact::ICQContact( Kopete::Account* account, const QString &name, Kopete::MetaContact *parent, const QString& icon, const OContact& ssiItem ) @@ -42,7 +43,7 @@ ICQContact::ICQContact( Kopete::Account* account, const QString &name, Kopete::M if ( ssiItem.waitingAuth() ) setOnlineStatus( mProtocol->statusManager()->waitingForAuth() ); else - setOnlineStatus( AIM::Presence( AIM::Presence::Offline, AIM::Presence::ICQ ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline, Oscar::Presence::ICQ ) ); QObject::connect( mAccount->engine(), SIGNAL( loggedIn() ), this, SLOT( loggedIn() ) ); //QObject::connect( mAccount->engine(), SIGNAL( userIsOnline( const QString& ) ), this, SLOT( userOnline( const QString&, UserDetails ) ) ); @@ -66,7 +67,7 @@ void ICQContact::updateSSIItem() onlineStatus() == Kopete::OnlineStatus::Unknown ) { //make sure they're offline - setOnlineStatus( AIM::Presence( AIM::Presence::Offline, AIM::Presence::ICQ ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline, Oscar::Presence::ICQ ) ); } } @@ -82,10 +83,10 @@ void ICQContact::userInfoUpdated( const QString& contact, const UserDetails& det removeProperty( mProtocol->awayMessage ); kDebug( OSCAR_AIM_DEBUG ) << k_funcinfo << "extendedStatus is " << details.extendedStatus() << endl; - AIM::Presence presence = AIM::Presence::fromOscarStatus( details.extendedStatus(), details.userClass() ); - setOnlineStatus( presence.toOnlineStatus() ); + Oscar::Presence presence = mProtocol->statusManager()->presenceOf( details.extendedStatus(), details.userClass() ); + setPresenceTarget( presence ); - if ( presence.type() == AIM::Presence::Online ) + if ( presence.type() == Oscar::Presence::Online ) { removeProperty( mProtocol->awayMessage ); m_haveAwayMessage = false; @@ -125,7 +126,7 @@ void ICQContact::userOnline( const QString& userId ) return; kDebug(OSCAR_AIM_DEBUG) << "Setting " << userId << " online" << endl; - setOnlineStatus( AIM::Presence( AIM::Presence::Online, AIM::Presence::ICQ ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Online, Oscar::Presence::ICQ ) ); } void ICQContact::userOffline( const QString& userId ) @@ -137,7 +138,7 @@ void ICQContact::userOffline( const QString& userId ) if ( m_ssiItem.waitingAuth() ) setOnlineStatus( mProtocol->statusManager()->waitingForAuth() ); else - setOnlineStatus( AIM::Presence( AIM::Presence::Offline, AIM::Presence::ICQ ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline, Oscar::Presence::ICQ ) ); removeProperty( mProtocol->awayMessage ); } diff --git a/kopete/protocols/oscar/icons/cr16-action-aim_overlay.png b/kopete/protocols/oscar/icons/cr16-action-aim_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..5856bd05dc937b565ae6bfdf49da561346ef821f GIT binary patch literal 443 zcwPa!0Yv_ZP)Qkte0}lX*LTkd8Nh_qpPF9ew@;t<|9qY@=LeJF$BRr){(S!|$H2gFg%|^vzyJO(aPt#01LMEH4A0l?`toDn zqE?1?4-XQKMkaO*Mrq3^2CLYd?}EzwpU<8A#b_4D{qHA>!vB|dw=;Zy_YS`iB8IgL zv8R79=HC3pXi>74K~&R^(PPR*#+38F8N@A`2qz^$eGLZnjEfA)@x2VJ!tx9Z3=9ms l>Yfa8K@%9bWYh_12LKT!dXodx5mNvF002ovPDHLkV1lgr$$|g? literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus0.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus0.png new file mode 100644 index 0000000000000000000000000000000000000000..65fe842c325406472e1fc9774383677822f75148 GIT binary patch literal 930 zcwPab16}-yP)1w!oHKXYDU2=CP8r(bI2dmmLXl87V_?yNL_LR@H& z04oxrC@ZYQjUh!`w24iOrYwwXsE*JrUtmGk<-KDR8M@kiSIuFy8&4~N;)zJspL z9~c@O=FFv&_(Lt&YrHtU4tsIpZllXB7GraszcfH$E_0-&H5_mReB#olS4m6>wggQ+ zJ{?6-;NtnOnNC8W9?qT&vnlNMPW_r{hq{{@pxEtZ#2u_wySw^1_R05%`i=AePv3uu z`y<16FAs7YP*W+ozdgk3%@380&eB#OD0E$SUe#|Ef^R&ps5KivTFW3;ShFfXO#M!= z0QYVpPmSoOH9(k@kmjVMm=p?Wx<6|{s47x|5FjNWEsmZY$MURLD*!kZfRZ8SD^KTz zAWiqh&E))1j&zREu>S(}(F+{CHii*;i>@z12oIDcABLu%Wb=PMUT*PrGr-ewdHgUn13wf!)(2M%ot~+=+&i|G17#{R# z#%Rhn{>RMvQQ(o<)YL>-^%j%D;Rny$ z?@a{y%Xo%>ak27&nx?8%E@rpx3oY*Vmlvb{4NGB9RmCMGXV%#sB~S literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus1.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus1.png new file mode 100644 index 0000000000000000000000000000000000000000..4d004ed92e3c67042d8aa907ea5ee38024e6c00a GIT binary patch literal 1048 zcwPY*1n2vSP)+@0TZLUKzB70y_m~l z%(6tIn^WU1mTBTJONeoqn-~7wC^~~=k!_5!A!r6=Y+YN*7^P6?Y0uwxydX2a$$R-+ zym=pj|E0C1S%}9XqNZtffQSGnp~SM;MBe%R$af@}eJ3+j@c9ZGKB`V!y;wk$T=odw zUc1@V`dF-XU$d=K$f})^!&!5??U*xlC8k$BJp0eJsUVFT^nksjE>Y3Z_VbMay*u&O z*m<%6Z*uk4S`EG190%p1(q_53Ax|o)1(jrQO(B_u8Ea{3Bt0Jv2QPJhBg<>Tq0KE@ zuZ(^5YlqOyf4MX9&&l65?=^Yxz$ix>P{|0a>*1wUXom z72$zn!L0O>ouq5J1gFI8NB3y2<@!AP^LI4LqPLh3qycjU;LGqEb9lVqKCb80BcAZH zZILr#s^Q(8hLb%U>+kDjnx@$WP3iLPKHy<)icd~_4N5o;zuf^!fsalOA{GZeJAMQ3 z11l?OyES>$6EW9~U2nX9nsRQ6l9SgG^;;`AGK9S^pF;nSFCdeOAUN~`x?eqoq~joh zH*Wy|oYFnguy)!p{ri{05UO^P$}MFjzr4N}Ep6XK1ecR+d}0Bd!!mV1TL<)25Hkaq z7A`OMA*R>k+@}{msBC-F!w4Zn*R(9x<{g40Y~U6LI0v`^zyKHlY!(1OjjBk@rZ@p% z_x?C{LD+xfFt1OWOY9|0&-P6O z+MAw;B_?QkeO_wX(L)?gCvxOmkVkVYAel%axtz9sy6}a$zPg(6`D&Qow}q2^ue^BT z!}t0Ry9#B;Z+F9FJah}1YQZ!OsFn#grLe$|UQ2-~CPa%tTUJ3KVD8RfnAOyGC5JDM zPB(V$e%e)3jE;g*Lvg3e#3px)n-%6(#^tB#0lewnlf+so6E~9ui9+3$0SM0DTaxe!u_6M0{iXn{Q8F z1rPvzy`R+C?2dQBq0k4P25$75p?j~Zia4w|U0xH3Tsjp?WcfY5OTRd@*8G*O>%SBV z`BP(K*A_)z@5eQEhx%?X80d+D!3+P$`2kG9s7=&iEsskT58#bku!!i0JM??0k5 z+4`yR*q)YpU2jdNlBSZ+XSG-?{-IOK?|Hg9T3XR|yv)(iE`;jEL=ln@*nADBbq`Bg zLsO-F^nBa3HPtmYw{@wiviuDtlZ=--6nXdTe@j&K94>S2YZAz5FwzK9fB+#ZgaR(T zfjaX!*UbxKH0m6PZJ1ugp_NU{{xd^!Ai#?05vNX`BbUjrUl;V9d=W{4Gv5z0Iafma zQx=DwXhhfj%->y*11*nVl>nLp0ZyFgVf4y%dcXXdgx1Z#g`;dGmbrLtnCIXAiI}sS z&%ZlHJUq>3{r%{=pF0b;qhfGyaI2}QNgWy*qVuI0_SK|zX4{5fd%_2IXGP=B#kXi_ zX<=k!q^QjPJE_jk&oezaPUn#*Fq!o*5eGjh2E0Jr8)l;EvV zqFFEH>NY^wKMgkFIIcNvE)&!EW6E91Vehp4^gAD@&$Ba#+F=U>LBq0pS^8 z-MnN^Pu?z{AHD0o5>6;T$Kshq0npLWp(wKKb`olQVgKgKzQX2FUs>i6&0Ta_79Tx literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus11.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus11.png new file mode 100644 index 0000000000000000000000000000000000000000..3e16a73699cac6f604c5b99fd0ebcbd02a689056 GIT binary patch literal 824 zcwPZG1IPS{P)ueOrGrjFQu~;dD`{xr`<9+xI7fZ#uyxxww2A7;bKE#sKPZT&-3G&Yg2FU3%l4 z_RrsO(9;aMNs6?XCdQY3<~5)X)T`C10JJ!U5|DuX)?Dq~i)H!c^&bb}J+JVahxVS! zMbE|=L#1TvOfhTy+vx3odn5fkT-~@P04`t5e_Hgd^?}xF3uU#mvXpb={5rYCX9$)r zfMr8`L}D~%+(REW`QZJ}w&IPAj}<^AZ+*0KHt<*9yMh!79gj)6yTpS&y_;W?ruyWn zm@mk=x-sVzK=5=WY_~do{`)TwO3sF)un5*(#tMoI|M`Jr)SmV7r-WbEX-NT0hX^v2Bc5n)3W2o(!p;5K?v{?-iU=L1>g}15Ka~w2tur7y}a^29gIgZ#DWamw~(h00002keLV0~8BN zvAYcg6%vXlDESKkB1i)Yhy*zbga`!o#8EQwWIQu>?!6QcE5(X}J=J^8tM}EBjt=}! z2!N@nDGA7Zy4~A-*Tp{G$K2dp+xSdYNuB@!Exw%Ok$0((!*XzV_%>4Wln#~o8#R3x(Cn%LlG=@W5*X1E*0KoM; zPk5fk_VzYPDN3ahlarHt{J74)ckc7{eL#7@=a1j7aq84*j4>1ng?<3i7=yJIV+?7U zQY;p69EaBDPdt14g<}`*@&3yZ-n@QEk|YE{!20?+y>_%FfOXQ4}#! z8|Un~2@V(E;52?=Y~v5{F+4mBKrWa2_5j#wG#W+U z_fbmqpTu!Y5Co)Yic*SvK2NPyLu*YGMF0vw)M~X$<#PFgl=2uLthHEczZK&9yvO%6 zt+mZ$GObFb^1>Y(8+!`81IB-*j4sdxJ^-EnYTS=ttv&P=2&r9a?C)?o00000NkvXX Hu0mjfDN$JT literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus13.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus13.png new file mode 100644 index 0000000000000000000000000000000000000000..008ab3dd33af780703fd76679c4d065952dedb27 GIT binary patch literal 947 zcwPas15EshP)n=HRhwm9#l#S#p(p&p$&whhln6lEyaij zrHCFBFCHrN;Kf5qt@I>#sIBcmRA`V^A|_2C-6ojOP1>4|?xwq$>?WDroq0Vp!QunI z)5G(>JkMY7KiRe|fhQ5$mIC}8Mn^||o-ld$?c-7_{F(aT<;Y=wB|j9_#VfiIOZrIM zYNh0CalLFlbNRwwjT?^*qCTCo?7$-q;45wVoe z<4FR^G?6_$BA&LQqL}Z_1Re8Ek-V!yj%M4o{K7838d2^iR^JiJ=sF;Tt`KSsyfVTs zAygS5U4l&}VKWqT=Wg!~8**)WH9D^YlGWlHO$U22p-fVI_2oJ8_XW?kdwlfqQKW>Q zFJ9v6HG@nVK7GH3Jv|Zg-ss9vNR3NC27_K-q&=a1d;WL&htA+cPcm|OkWJ@4KYjlr z?Y-YnGEQ>#>Hrgyw@Ae2rDc@6f#-y6+u?KeShfAwKIzt0iL`cs@*jf&)PGe0<;6S^ z=K;B2QKu&D^Ex0rYAA0(Ma-bU%{>l!9)8_JdJcZW10fN@#|%Tw10?}4B|vRUl^UBR zAt*3%rpRYQ1#n==q}q!Q%*H-qq2gp0v^Ms8}uFz zF#bc0ua6j9>C$(%gOI=HDP5o0_YLlMnE_k~&>4#)UiRMg$ zdl`k>TjRyotK7U0tW3>yBtcEj?-c{|2#v6uG z;5fQFUq~#^da3F0#pbEH3XcOhV0q_&00KY^NCVx#e&A`q+@8Q1umIc!{sxwS%D=G| VToK$O{+$2-002ovPDHLkV1l*Mu1^2} literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus14.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus14.png new file mode 100644 index 0000000000000000000000000000000000000000..d84ec8574ed0b80c6fa649bf7edb8ab15d54eb84 GIT binary patch literal 973 zcwPa`12X)HP)ule5LxhCyeSrXQv^MD^5)$? zz=H)T9ux%asrYeF!1cxT{!er;}cwqY3cn&%xqs#doxRb6`^Ne?zm zvmT8`9l$FT3gSP4SJUalN445#*M+#r)CGd;F9poaA&rkquH$rfx3-GwYir+rEX3DF zJbq+EqbqT{?0E*7PY ze*Y|Dnocg46S-V2P+pUy_Y8=iDT>$+JpUUxXx(%A+ncr8UU_?)Yt4FEZrfsPW+ruY zY;38syOY>f)m>fJ9l%!(Mn@|})9h9ZL)%HFybot*a;~PksZ@GDE`)!@>0Wx&Zh2W> z$RXd?F2;wR|Eg4atVN?GpsP+^zWn=Sv6#D^&)-z$=M%AHQhs}K@?u9(#=@Sb8Yd^@ zYBdQ>#sBVmqJx2czSp~P76h9}QcDGTbM^YnY&QD>i3HBV0&*^=8oEA25YVnvNUW`? zSQe-CIwJ>4dBhJ6h=jxVLU49^N+=vAk{t~WhBy&8!`Hi5FHX&n^^tW@l*KYpIjNEFg> zh$)~r;Pjwt;dxzLNwB9VgK#+9R#o)~I1GZIqXK*piGOnUY2A)D+E>iOYT}%-ucLq% vcyzlx(eWkM*7UBJn68fKdIM+xHK6ksxZtJ^xl|T=00000NkvXXu0mjfB%Z-< literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus15.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus15.png new file mode 100644 index 0000000000000000000000000000000000000000..3a9491b23685c10c0141876834d73ef60a10c16f GIT binary patch literal 925 zcwPaW17iG%P)wS8nY%bK}oeuG%>N(RX0& zE{FSY&f#z`@EQ;iE2*sC+3;F% z2I6Gm>J2Ar3ktJO9sQ!_kjo{taLz;ksma2`|B5SCA85#*<2iEl%a1-Lk|zK}#0py&d-Im=mau#m* zyDhBB8Dk>=Y+06V!!T09E9rtWt8&^qtF|^eol21`o9dz^OLJTTDeo>f5l`v3{$pqS zz`o#Nm)v(6Km@=Go)&ZOn{`D+3;g^1YnFcysCi2Xtj^6+)cy=p_n;lW;pIx2rwOH27H;{bv7rYODLXIzn`K%Kw z3irTHag>+j@JPb5u%-Dzmn_Rqh1y{AAC={9zsCwA_WUXC-f2Z((>9cpmBF-9$ViUD z;vBZ^L9Pqn9MBWM65qzqv*DH?n>sCPhG3}}?0$fIZ5_zX%SB#60pdv@Iw7EQbUKco z44G@IHVp>9KCeI50jC0N*}h|*t|tP*+S>20*6sSFhK=_^6l^Hjb1)L)7v1*F*3n4jxM|~-LwKu4C zwVu7NCm#B80E0w479GCbc;(E^d9utzMNu^INq@(mJ>5h4+=4tOV?bORM_23F z2SltHKqr9508{`m07=f7l$ptT0LTDrmWcLrwBK#(F&SWUU{o_wKr#j(3?P)|q4eFy z06a_Yy#V^T;xJ8Bjf+#V%c@3SxcTKDPH02jx9&I`QhPdG(=^RA48t}IBb8<=JxPIx z9E^#xB4a`=tmINbh{xUT%nkrAD@0%Z{bcwTof}Ag)G)-R00000NkvXXu0mjfvt6Xh literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus16.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus16.png new file mode 100644 index 0000000000000000000000000000000000000000..21477bb9e679ae95d1cc13fcbb251f2bf4995e76 GIT binary patch literal 931 zcwPac16=%xP)#WhJ>(a0^S5C4PGij(O|?Lya^&b zdJ_vOLJks$P|_m$7ueLrLrKVDf(b=Rnyeu+4Dbux(qv{cYhOGhKU&=*yq1uCB%`%L-MiRbsIiJv}|LR;#_Rx3~AE z=XoL1G}on+HQTlW@#%Z1Xy?Gy->zT3aj~a6PVfvS{r&y4wziVVWU4}ldzNK=)7;#= zEXK#jA52b8wm!TYbR~xcJ}@*iL=Xgcp2x<<28V}-XGS9DcXwmZQ;Y*Yrpvf)D~JCBE--aBzT93V^k>HHyVz-LfoME|*>TX#2>Y zp1wQG;~3#a^TEu_jPH3K;cysT*O5|Un&w%8WHMPB7#JwTVzJfs_VxuG@PRTwTZ`O3 ztW+wdX*Tcg?~}{r$mjF8uKVxJg$NA8DDCd<{wRd_LkRI$0NlTqO7*{bX@=@TWA9~I zxnSGjNF+iu8pU;8=I7^eT^A{3HI+(j7Ycb=$z-y1XJ_Y@5Ml{f0iLGQ=_4HwX!Qs*fCy<{d{BDrqwl)zT)8sb5vX7<2$TV+ zOeXWS5MmqH0*b&ffDTBWR{umqx^N!`?|&8jHPi$%v$HpV1Hd>zQ3bq{GSyC7DICWM z0q48Uc~}41k{26W%&p^NW`X4sP^aG=oK!kUr_<^b@IR*6C0*Bmyh#=btRw=~7hlPzcNr;`K3;6?V zqD2tWq#3LPv9oXx(i|fa&PG#2B`Ly+Xo81#dzrPFg+oCwQ_Oq3nfJY)ibI|(%M_s0 zAsnNXm6cm%S)TXaM~4B#TI&M9IX4;oZ}duc&Rqgdt1Qdn<>lp@^Yio1!&~_ehSFO1 zopW`d0pyX^x>#FVdp0vOb5%t8z;O{NfYCqXQLS}9fEvIK@GWxA9Rp~$+povR$LB=k zyD=sek$q###E{$zsb2#;@C*1E1!EmxcX#)RF{ULVUyLyqL}X`3P7all13iEUD3+F% z&Hxx=u8YW9W6YF@Y#L)OipXXZMbldAkIuO!FaWv%;3L2;a#EufV}DAOS{! zlfXpK`#=H|KrKYw27UltYi$7#SF>-mS`U;`4*`0;-qTK}vkLT@&E~x%N#+2GqIkTq zvGE9qvMh_NwZ7V{QYm#m&-1Z7&&O)D+U>AV`$>}AsqAqa-vv&D%&4XSfcJj2Ua$Ak zG%dT`?n__{IPl)DHX4mVnx;P3PXR{&MRjFa76*qEI2*uQp=Lr~&V~P5z-M6JT08g+ XKThwI7tuOu00000NkvXXu0mjf4<-?n literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus18.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus18.png new file mode 100644 index 0000000000000000000000000000000000000000..c7359934366ada152ba32094e241315c13609c71 GIT binary patch literal 959 zcwPa&13>(VP)gJv zUOk8x!CeHI2!f7!6LzUgaOgpFt4M82*Sd9UJ8HMpwsC3NWNDK3d7ht#Z65sIKk$Xm zNAbVq^Lf8iD)}O!j4@h7JOHJX^L^hcr6iNdn90 zCta^jB$DD3rdq33w)En*+4sXY7i!;^P2072JW&}K7-*=6u-d+K_`Q+veVvk*c6B|I zZps}|L3}SF8dKY#Qkam!;zV_Aoyo7q)R#Nb`Ew$fENXzkN6QD^Ii)@b+nZm`_8o6d zcOF+^>Irmw4_z-ROtF=aOSLgG2|E*&yuLrvt`E>8| z&GFo`IA1WXgq1Cfl!&B=^Qx#s3P0)TsCczCmC)h*a&pO&>U2BypW#?%ds=1NID6(C zFC2!mXFjK5mZ-V~E`0YXFFx(@*~jPb(uUTaSh%ODFa!+xo-#R|FnyA3Qr~{{3va)9 zp1w!sXvuy=xpJQIA14?-I!1DPj>77@Oiq15Psh5-w(R6Y%Ig3agks68y zqQNP!8r*&R&Ay0NvO8|a)HjnPw*L!CL@))#jV~eq`ac8_PztPpN;xn9zLW5FtrRTi z&Bh^y;%S2V*2LR0hhB) zHVbM{!G@4I6;Km{0L|SI4F~Ej)aJv+;zn)_xTSl0d;PiV<$FDC(ZPVI!=*)=q$NsQ zjE-;`tatyu6rnM#?b2MXFh12b1F;D`G&IC!*{@u^Uf zL*w_badS3T_-VZ3ij~x_3N@u?W@cP}|C6p3HEql<>D5%=$MuTJ#P67Rcw4l;2yQko zYm@2iKW}v0`fajp<^lYN)_TDQ7#J96Oixc2tJU_)7ccGJ04|HjAz&YndLX6@+)_$i hQ81;oUI@dm_%B2(m|sJzb#edz002ovPDHLkV1nX6#CQMz literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus19.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus19.png new file mode 100644 index 0000000000000000000000000000000000000000..52c8bd4b44ec11df08acf65d00717eaa2ef47e92 GIT binary patch literal 940 zcwPal15^BoP)A$lo0*;6nb~a8rOj^AO-UuqpSFsjQYf}2YAh*Y^<*0`{->#U zP(1V^coD&i2dM|WND)f$pcLsvQBttd5}O1~(;7q4fN7d!lig$|o7vr&@AHtfo_yft zy}S><7k+|m-hBNvX)NE^`R+02s9KzTIc|!l%!HR#NGcnCVLjm2VygA>g^}=DL8b52 zYPDc^csLXfWHt9=%Lh-IZ^aGuO8tQ&&CcE~nPGT&A}_lW036gsBmF4Wc4K75L@5k9lPOW5nuH#8Y;x zGCi?7;fS@#758@uNLKQv>N|7Ic5_+~{e!Mfqk?Hv&2euk${^r8KmP#VEa`Q+N2 zRAaEz52Q^%#$r*g(^6*$xdgRk0E7mqK}QvI`A=A%K$Mpd6-8armyPji2e8`&q!lM^ zCe{$OnJsy{8LdH31%DI~%tBN_Xs}#x9TGr`35bX)I-1ieSP%eH-xS$5;Gt>}r(dX| zH}0T?M8tp?Xh2HOAA_$^2egr~p-ZA0O{(0A99^8gZ11!u?QTl3GC^Z7<_LAVCO zHNllz7w&&kD#FaDwP757y9NaE)aij|CbQ>WRbB6USMQ!@alQ#Z%jubMN@M1O1&l8tNO&LV5Gc?xV+ZPqa2MGB(QS+!wle{ydxVq%hbZx4%TN zS>ej}CT`(IW!35~wjFyTKZRQpe6BCzKiiHag zV+IEYUpjd3(ILl4JeSR83BwSj6j2mC+_r5a4axZE_$7a{{8`!e$NvRF>R8Bw(>Uz_ O0000sbjvG5RCd5r>#1K*_sA_RrT2K`p%GiYo2BZ!h z5HNy-sD#)6F@P!%69a-^+6j~;4@ydCQI$GvlE$@b$4Rh#{m6|U_s@`ov>fRy=hOL~ z`UL+&JRVnohbeYL60r9;IXP+bP>`3-oK%BKDsb_|t`l-SHSQ4haYwuEx22$7v)0QE zb=EW@zkD^lHMMCUNK45U&=Py*Kz*VA-BbD-PL=bWLq{U6$B(L7M-YiZ)67#@{=?4R zn9JvC^2(Rj_|{Yp{w<-R0vzve^uF_g_NMoM_pP22<3VHOb;WV;FscziHT*byAzYC` z;R*QMY_7(_uBve>-&(Dsn_4^`S1z7fIo8(NKJPp7T(|zjurOE7v28uNo3?f^`o9z5 z=21`i$Dhug8*HS$zfC~{6bhT;oudO0JrWR~e0&*2#92zId~o4c06zTuG@)LA%e?pY zpok1OyV6tZXQAhs0w@lp8F%%0)Jvbv(y|4OmP#Z9U;l8Lnfd2;%{#dCMG|l4n&Nj9 zW58hzP&8foHCKtJPJYB#D1ob<5spY!w2bz&8-yG1cpJe6BkHY}R4` zIGs-VJXbLbP}r&vtO<(tmRlI>drR@G=UDsDfpsso)( zzo<21t{&T2DVK$--5_|#LuklD@L2S!sbt~P- z_c?9DO0|M+pWQCHO<@*IYTG;9$du*cWLsr^xjQ*=w|A-`+_NB(V)p|zfi&D=WBBEv z(pXQce8%ss9`YD1my}=@H7iy0=9XK&#ozCD-DsfCfmi^tdkF;K0K7miFbF&eL;+)W j{1UJVEC5L$3sn9E<3L1iM{^c<00000NkvXXu0mjf%l4Tz literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus20.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus20.png new file mode 100644 index 0000000000000000000000000000000000000000..6c212bd06248825eeae1b694ef53071959ae8116 GIT binary patch literal 953 zcwPay14jIbP)S!t+c~{Z2~tu#3JF_p#olW?Hp+ zg9`FqVl}q{+v=jNs`%l%Z`-L<;ulTTQ~aIvcNM$k^9zX+tbvP$kX=vQ1U*4EW-?=4Db#}4|QsT&c#A5yKZ1OVbz5Yi+F! zRjG-IL?Yh%-aU%2+<&$?@WRgS{GY4CT(K$`qlr$Z*}}^&P3p11G&dwf>$#QRT@1?x z6h-m$VjqEaC>md%m?;H1Wpz>ros3bWI~)|8vO_kPAMD6&+OMbjhhk4FI#FI+T=I!#&MO`ri$ukYJ+fjA3$_&RCPHnizwa3hMS0@ngLZ>|1^sBSG>!;rSXs<(0 zIRq&mTEQ3Fj`yv_-3(#s=Q(Nfl&7-p9#gjbqqdyVJDPu^x<`fkM02n2^yX75oR7bl z(Kbx~PsH&?S6dEu?z6&4+Eo0Gdhmu@uhG0x2=-MT4FsV^1H7B9(xmj4ki5tDzrMa@ b1-}0q$=_?p^XthC00000NkvXXu0mjfIqt_x literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus21.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus21.png new file mode 100644 index 0000000000000000000000000000000000000000..46d211579023b6e39d398ee30e3f3263b79939ac GIT binary patch literal 961 zcwPa)13vtTP)M-D~~JpXt% z$NNJ7%%t*MU&wK5Wj#}?RzBao^8RH&?i;9paGbsLZmc)*$@y2F2)_KVPAuTTrfI0E zLSN9wiN_wIFWk|d{;Tmqt@qigx$wiU`$<&CYac(?7VP@;?V+wfk67Zun{QDnu2bGN z*(w>}@UY$7qr>AO;CE|_>&BtIo})?g_S7nXsvSOc;n?AWCtrW2NV#~Q?2L+4b47K+%fq%-9d*OWUH0Njxn&j_JI-SlHpU=0W0@6&)EZ03fWR1?4 zQGU_uG(-G;V~V*uDV&iP%i8$oOn?h$1KLzo zZPzrdT?nB|DGe!QK?qTHyWI|5*I#nG-FmfJot9G0?;HFdN_Tg+kWwl_2rHM%Nq}%T j>=Z%-03E1FDYyOxN&$EgDEN(m00000NkvXXu0mjfLPN}` literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus22.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus22.png new file mode 100644 index 0000000000000000000000000000000000000000..26ecccff09d0b37470a1c8990f7a1e52f3d013b5 GIT binary patch literal 846 zcwPZc1F`&xP)AincAN~3fLeBjMy^lP9F`vl9JOe zpIw(o56oi#vb6>NxH@Ihc4|8*7e2dD`vQmo?R1Bo>7&7SQgV89>T}UweFdA%A)-5w z&f};hvhzK5w{lUnZyEF4r!vX1`dB5Yg&X&(pQ`hjTm7D_dV>oR literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus23.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus23.png new file mode 100644 index 0000000000000000000000000000000000000000..99762c2e79ab7c445378ef97c0b017c570834091 GIT binary patch literal 498 zcwXxa@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%b@U_I1CZGssfk$L9 zkoEv$x0Bg+Ai=T%$8?x}hL~e(4>K?@)_S@)hFF|lI{B=&OQOiJ`tRpNC%0rOu_f22 z_r$yaj2R`0p_3h;i<-KrAU4SEj z>4=qb58v^^yXCi{4yjgdbZdX?v65i}gO$=+ji(QHgw;@XQS;BaB1=K-II@8v3OU#Ps!h>ckz|&9P_@tc$ei~Ev1?28fWt~ zyk*s%`onXJ;|dH+Ztx$tcu?;%_i0t>Z+!lB8H_zCMmrZyiPGv)s!bN%UZ<3QyX;hv z%=0S-Jq0FGbAPL9w1?l`w!QZLexnwFUI&&JtZWSmqVqT_nB*F2xeFStABYw-SaHcm h@|hn_j;$yfjY literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus24.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus24.png new file mode 100644 index 0000000000000000000000000000000000000000..424065083cfa5b295216281263bae144b3d26d74 GIT binary patch literal 791 zcwPY)1L*vTP)b<^}9C$c9=YRg^{GUev zXs-@D_tp-TFo8S(RaIk5f|PQVaZISH`Z|*r0Ilc6i=DgoYu?(SO@IPefv-T?h!uY; z1~3C$>+q}=+=@K7yzgn(y5=PSb>*@M7y;s$%hQW7x&bIxJ3QOEN}HG3!<|Z`+OGJD zBX4}gk&nPEV2r;&O1UyaU^*L8-`PSTTCdBoudyE(k(5O}mjD~kGieWhD8L>LbN7mO zkhEqgt!UA<-XjeVkH=-(Ce2v3wGUc{CNxUsx5c~va zfLTf@gfWj|keLAI*6ol{LBFVbg)y`Z2#2Yv!$Vuq_#%q-}34-Re-I$9!_%2QT- zarw7e7q&gKcMJXjDW%DfIt!Q!xDES;t2c%lZaywM^*;h(xMK!#fNaAl3lrad%`fy? V0232^*M$H8002ovPDHLkV1g{TXn_C# literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus25.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus25.png new file mode 100644 index 0000000000000000000000000000000000000000..a492946e41bf99abed9772a21be726a0bc153080 GIT binary patch literal 901 zcwPa81A6?4P)v3;|aG% zqQ30mBL@^sDSk6O{keKeTmZ#;hsX2c&@VqHoTZPhERsT&4L6EoUq zzu51-XM1a7yLS1~<#`QoJ@Q(%-`p=|P;_t%jQe_mMqd{`t4YmlA{(G+8jtN8c1znj zJe(fhJpSDA=e=Ryigxr^rYF%8{i4yPP_EQ*OE(c+N73B4aiKc_lAc~f3*x~z6X(BT z=-VecQl6;aYM6g%ddB~gPt(F({tzV*q-xr@q>iTfITX%dG)-#FI*Y4UIr-ffe=e;N zZ~DuNnc{eAE_SDeCH48@M!9AdLQA_vHmbX~{b#LIq0wq!(y})_)nM{s>?!FuLDgFd zj37(MY0I-?Q1VJ{-!LQ1fj7FNT=ZrYeThLgGweM_j!;;^pN%T43P z;{F#t;R0}^kVU{$02_g`GxrSo!b|iiSFT@51^8!Y2vk%A4QZ>uwh)*=O98C6gIRsl zcLo425OLagbn8R<43$n9p_2$F_n)J>T;`Lh(u6a5516UL_3Z!b$QdigMqwEHB^(`hh-K zmW8USV@B;w;pzq5n$Lf3&dslwtJ|Y9KmZUzmSy2$!!U+j40u#k9Sa77%dzXXPc1C1 zikFK!(st|IoM{hi0`GyA0I+S_(`vQ+nM~%fgFA^t;%qP&Tn>lBL#0w_f5o_BtT)a) z+xcmI01Chs&=dgabo!yw2NS5p;M00001woJC~WvOy-)CkY>!B89I#x8LLua!PwIZg)S7ujT;fV5ZrkK zsS9!8&ObnxuG|-~i(W8I87NJ$I87umnaN~ob7`B)WG3g#nR9cIS!oNt@a;YxzVCro z;u$ebQ&fA^^MMk~%qTP80|DU7&d&P(-W5DM!Y}xr`ycw>RL@nP02x3tO;h^cfZ)a8 zE%FeCp#n?*L%@Fk%5wlRTWGj|zy=Dy7SJ(GGX$i0eLjEs$?3<>1Hj19=l-N0w=}C5 z>&F%WtvTF`tVh>>m4(~{zEjk<)v|J^Xw$*;Di98Y3ArxU{Ih-~OoU>8Xn!i!kKF>I ztz7Hp@Iv@z;>W}~f|El0EzNJoBG`TM~v4LT5H8%}p?&xBg41@=kD`xW?!DLh0w8%a zxtR2l7O*9NupBRcre0T@!95_6?*+#(bN4uA-r`APUM^-w`PQj@-C2TNm7&qd6{3);o*s@_50O2sh z-NbI9+FonF;hpp{y;Hs8+yaW=b-hG56$J6bo= zg&wdAsDL||G2kJn4fU{mw|r$ZHd+JrWy3I}!cgI!*YN&K-A>h`^U=rArRa{dED3kq zO)3kDE&9R>MgvvdQ?2}R{@%pi#P7f#z^ZH*h6Ko2k=@EhvTM4cFYbgpW9^yt+1$g+j^*b`ftFdG^npUI9S`W_HxVa^0&v_V~xp?NwMTF vy*BQR-%dqRbwKIL-J%`Z2|duS0So^CjW#vRxIow+00000NkvXXu0mjf3s0bj literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus28.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus28.png new file mode 100644 index 0000000000000000000000000000000000000000..9c2d0415dfb8d14224ca3f846505fd4883ef6d35 GIT binary patch literal 944 zcwPap15f;kP)=vM`oJ5sV8$j2aUYclZg6E{L~f z)s+i~CP>1UP?QKs8zZLJh7uA*C8=~mTS}$Z>DOFiCOqv{JlU>Al1YN^qsa5OMB_2PllBWrW z#-7J_0wkKprUt7WP_`Qw@;b||P6)G7zFkBzobWbYE~sQ2lO05**YVm9P+owQ0nlX{ zaku2g*FecRdSw6ZRzAFHOoYx2#<~baqAcX!MvXWR03WT(=v>e`=I?bCH)E*-iJRtw z@2%}+hj=)E7Sf!@34~4&}fuc-7d4;F5`)!V0_}BlPforn)zMa<&DfgICyxX9kymX zfM0%|&~H-kMdws8_46ADf=}VQK8x zXY%1k7gcSyiIs?AhoV?0Vl||3LKH=8ZPZw)u48TJr z_ZBwG5NnB|lrS;unkK7jn=Gz8mbFJqVu<~ny{)UjmIt(&LHp~j-hod?Dr4NZb_-(+ zB0`pBL_t8S)glZ7R+p>1aOx#|6z^z_MGZQ~(HDv76`N=@Z9aQ3nRf^!JzPJ5XX@ zx2ybu;3}&YZqM1}<>fml`4gA}HWa|wGp}`M?H&x%+WT+5@y_|EzU8>ChloOJLy{zH z?`-P5W_Zn5^^d^3h%73lo(6Bfe!A37Js%hWCV`VcA5h?bDewfC1?~fzK>Q!buGTqB S!dim>0000XBM zR@zPWu)b_Bg{@FT%Q^<`p~9T)x|*(0rxm+&+Qmy0ysf55YGO=cF8{@UFA96ufx~$? z95@f>5bVL{^N~}h&(V17MXkYX>d@=-*6_l@LS}nQbh~ML6&9>Mq_T| zp&!KO^O4WK_)4>~w$|JB%JDPKN{f~+<-kw|1c0*Fuuv3`O793`*mwQ1yUI1q zP*sNB_`ct=vbxrHk^o)`

vMl4p<|Zco zc!)2%ui#==Cw}O?j!Z6(XOZXVzjYIzU%7+roQRgrF6dlt5DCyVx4?V$Txol3v!3--*FJq3oVxQ` zyYH?2QKbq%WtAHMz=h|bU5sLD{Td=0EBH;V;Jsa5F<2^yU8}Ru)!N#5D4r7Ac9cbsW2OM zCjEmre87!K{~!)ExG;M6Hk{==n4tmGebU7m+uBseFLat;j>H;bu~>lu!0PI%Vkpy5 zyThe_9@(&j!{Jmc8jYt?spy@dp=dIhjAv$M=t;A=lqxcjLvy>gmzU>chkca%=gzdY zp-CT_4%Pvv0Z_VU5kd$p77A8pHht_M!6?)-ei&Sr%U@z8nvrB8HwzbC<)?+fW=F~T*_vgjd;TN8(FW=Ae z@W59LzJ1|kS>E&^RC{PgGyO-dl$XXF=KKNSQ1aUbQg+){w$1_)F!yF`Y|I4E0K2#M z%x9lmg51yD6h@XXiw)IBPd#YyOeDFQ=`_o}!s(pB9%ZtU^ild`PxLO0c$gCV}x8~e48J5ekVMjqq zad)#dy*Rq8frra!W!hpyo%EFG|sM0I{N#a?N0N#XS~} zu4oxAY+>rhC9}Us^v6w_2O91Jng_u7Sc%z7pr3&3rjR#tt~J0=0P|m4V`BYpHB-vL zq37ZHy9WDo!6WBA^qq%&4wyW1*UR65HZJb6ei1VNK<|rSJ_!rIYDRL|H}~7Ez_^KJS`CFlR8_C>=UQc>O{u%ftM#Dm zA=wao1JU{#1WrOz6tXoTXMeI5lMBAN(UtbgRrG7Xya0$qBATYEE<0Pj&m7n}7O3tF z20W!6-Bq(o3Hh96tfpOS^QM1ha;@pFs5PII(Fdr7JE27{6x5EYGgzyiS`vU*px%ZrNVGmvH>#wk1 z-Mc^J_6`2q@GnpRa;>e$v^KrTR0<`s3qt7ZI&=$QZg!@BZLNlLe(cBm_jdvihE2m) zuJxTuXEMfnzr(z3r-X(1`Nrc1Lw8rI)jucM#P7iZ+>C9Dl4^h zuS7_k>XAZkF9ZR2&+RZs$kSn7rqeebW-?KH1Epwh%d@gt<4Ng_ctDAW65(PLaddn< z4(~l45RrJ@-JLW5B8rygW}+xU+=fr5l9EaW-WtQeiPN&ji$4DbfYur%oa zVQr_U!8sHJ2B6Vs@apxL`8fME5!ois7C-D$A8^_M3B`=q#6sYBi#r?G^WJDh!Wnt&7$MafUbLITMDLl}JLij_`N_q*86o fjsDlC+D*Rz!2!KK+zN$u00000NkvXXu0mjf+2J84 literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus31.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus31.png new file mode 100644 index 0000000000000000000000000000000000000000..44f8f816a4cd174d74298aa8825ae6c7efaf0fb6 GIT binary patch literal 912 zcwPaJ18@9^P)$a}U(Po2;xz!=I##v#1B7=%uhAsvpAqzSs_@o9O zbcqXt2V>%cCPWfV2oK1E#26R<;4nO(tW6jUge4#(Ev!t+GVO}3WNp*l-rnm2nCJ}W z@#N(5P0sloct9<7badHZp9=)SHrP{vKz}F{@+_Yd4+2yaMVSG5u3kMg1Dx0OPT+q4 z+1uM&12_Qba5(ajNF)!iv#III+q%Ak%a_Mbbaj0)>2ziRZ8<;*`q%F6@Mb=*t#Tu^ zdRqKXj~L05mm&+z=kF&z20RMH9F=XlIDQSO6MFy4>(PIbUg_Jg8HhCc)-bgDO?2xO4(0Miy2Gus z`%QpIxPNdDK)8Q!Pemc(4Xh(Hu#Iy5E(>#U5?3xDe~Y(rrc#4#+vMgak!BpbsG(Lh zAk4xh;4@%Itu~0yOrhofU|pb-r8{YEBxaFjE{S3&D8Qkk^9;YVhQUqSs57qd^QY!q zC=?n-NOS-8Mucl4-$oN0J8}qL$67!`RLUksp~$7Fn@k+s#jf=a<9)%6h$(SS%Jy;p}OsmM^z7uXz2Lc8kTLlSJN)%sj&#ffiFTziA>0tf!R3-y-86ASJEAO@tR mkT06T@wm75)xFDpY25EAUfiEI0Le8Xi?JDZemcctI` z?mhRMD?K%FNKMcG>X@b}zkKSI7Zh2k2Ly*hdN__hP%Tx9OE(s7rhlJLU$&~2!+pF| zD&+x40H$fmr>4)GKYjYl+1%DYVRj;JE!e*eH>zN&bu>)fOBA3gSo3+MNXRndc zbloydQ)vs_{J+`Tz`<5{Csu`!@V}HaCtv;I(#5pa5&Yzl@$qjIfOtGE?e3HYC!aZb zg#V*-ox26Q7#|s4cye;G`|9N@`xL)#j@BcpCzHmT8&}SW2eSN`n4RwR`X7pZolGR2 zGc^6uh1m-~JsjLIH$?V>8it;|I=e<<92y-~!eK2?63U&v zef!^4RJ8(>+5!>uOU-Z7>m&{yz#odToQopsQKInyG=Gr!t(qv5tRG{Kj=rzydKTCO z>g_>Ni^YvQdMSH6)NKVHdwfJPbd|9q6Ra<;F}JefU0e1tdTij+fEN4<$N^QrYyUCL$!SN#U7{ngb2u?sx4ew_HR}+N>GXfTD(Q4Y%OKL$1By^!xWmltVLW8N7bYbGg zg(gNVV z=Q;0t1e>a(qeBBWOKh|h-~w(e77OK->6h81B)UfkfZn4$nw}c6jvolLx$`rJeTHZ^ z{K2q`Mk$|5XNp`|so4I*H^Xu;WgX~z^4MF?j9vKZ&DPfaNzr?>M|0!9)W7kB@sdw> zk8F9UB^qdK(e;Xm0!=vC6xpfY-Q?B5#fc?;o@_fMhZcQ3?aeix9DKO$L;cana`o%` z87ixohyEU`senij`MtK-Byp2FzvnbzITQ)QC?~XyW_r4`>#GlTVLN!6} zqH(-cwD@i3h_%1H(%-a8pyxs65v~9MLMVg*!N%>FJ9YgP~Rk(wGx zxdActj!)KiKcJagD>o;Kt3bGGsMQprFoUp5*sCy`5DZ^b>b=;59~4XWSwpghl5yo0 zlj3gVQsUYYO=eJzLHmbf zktt6AMF3;j7dm_EpOwc0O-^;N4usHY*zHjFT_qaJK<=(D**Hwc%={GA7_b1KJAp`{ zF<7#+g52q=Q696x0dEnE0>T5zTu09&Ve*nu9GR|~=$oq@a51j}3wpHak17FW55`&1YiKtkusO1YW(|& uss-R8*J%JOz_)RJ5l8`XU~XeL5AZ*~F>+TJKi>NQ0000@>A?R){!8YveQI|04JBv` z5Ca%Zk{A;kV-nYO&A$T5w(XmXZw-{r4~^WMo4oAUGNVX}X^Z5nhpx4~>e|-+~bzM3e!zVv4{wRv@+ zjC%jdh1&~bTV-${YC^jX;((Qf-~{{=h$9F?NM0PZMvk(j#>;oKVO+&JnJ4cE!7=n| zhVGFNgoX$q0NNNdf&wheaz7FV6+4ax2PTKpqpEEjR>KCfp$8a2hY%u!KnNIQ_Y^kr z@N^hislbgtj5P8(2cRTMhBux*=WxO&h+?cW81rGIkmJizm;L}c58&AvWNjE&hS3>N zmSt%`DWmmV&Oh4$(MTaYPFB{k#Bx|jC7yFNP?Mu4Y@Q`WN*3Wcaa0t zimaW9g(b2Nf8=-#DIP+{LLPYuwYHDtBcmEhC3tfhIhTV6yV~rvLeEO4o~iZS; zp1*tTou&MzQ-Qfr^Ta#zjgDhcmL``8O%k0*v)-h#f%(1)znMZSk<_{v^NXD;40b99 z4P!MA=P%hS>0)k&q0EsC+ckQfItP2FvbNph=N-(wW-)w{j8;3U_|US|SFZc}eJPjA z8B3VxSMkSrC;lvN^)B|CcAt_c)eLN@bKn2x02n^j(0DJKOW^c8es@_3zbhZv`Ne8Gdr(*4*W65I9x+ zr})Ur2z%9P^yuNzy+*yhU;vzRQYx41+Ujc4Ij`e9uhYLhcjP=qrqY_0hVu*Og>O%O#f@3%ke-eFxDt*#moMgw2QMzU&p z!%-2TR4ihx9q7OqCW-|b%@&Uv;d43@)$GFfrueDGC~~3 zND^w+Pm7;UsplN3Dq$4qm#gAQ%B&n5{Ip3Nn?4|lBA&lk zcUwE3hGK8HpA5+Kcvfd-E+K+|=;Gp{l*&_47)D+n(Cu`2v$@HS{e5bOwSjWb<`l~- zE5Gd|q*5t1UT#RM)$;l_^D~(X*4nb?rH~_5KJH3Tg)r=r#L0(dv$6SKpXwz20-I3G UT>w)|*#H0l07*qoM6N<$g01ly2LJ#7 literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus8.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus8.png new file mode 100644 index 0000000000000000000000000000000000000000..77a87ed1dd65530a144b9571ad16ce8820fd2f2a GIT binary patch literal 1027 zcwPYm1pNDnP){eN2>f0LMSS=Xp-v?l_bezUSC5uCaX+&%N>^v7! zucWMAiu6w%XM76yw;oVkr>AUp62;li6Rq`A+3n!mnFEBn@1m4cKLvv2zs%8+F$tnXe#8Y(iE1W3H zV#y_eArT@I7`iaUyj$YJZ3Ur^L(#{R{ze`nKQH1_)h4NTY}ylWI%(+ar{-t{nl2U$ zrvJ$yAri7N4oL)Pv-+q~V``lq^*bdX@SeInJ$xuPd955959$(fFaSaZ*DP&TAALEc zh@l?N-*DltAaUpwdVpO^gZ8F_j9#&%6M&b9yPvbVP1Oz?XAVI6nujEsy@-R9tm zCy%V0d{VcTFdULe`q5SVY}XS{gwjQfi|azPI_4O!ivxh`!KAWXJSC1!B-uAj5yTK38&lPNH2*A;(QUH6f`w1dyqyhBY)6^9k35U` xoT0Ga_xHK3*eOlCMBj)9ga85{hY{#H$zOM4e9>gS5QYE%002ovPDHLkV1m@(*O>qS literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icons/hi16-action-icq_xstatus9.png b/kopete/protocols/oscar/icons/hi16-action-icq_xstatus9.png new file mode 100644 index 0000000000000000000000000000000000000000..86c9bbfe524a2d1aa1784ffef09d0bf0ede60c9e GIT binary patch literal 811 zcwPZ31JwM9P)e5cA z8;F6S6$>j16HB|5A&S~W2@--3L-0M|eTpLgar^c{#OG6=@d@4&7)J4gZCAGWd@a?j zTRXi|r+$$>CQvpPs;X+4Og7;6w{}J%+me2N+joP5@&2Bk-onbtedCjYR4Qc*4#jaY-K{TN$WWwPNOw(d&YTlfioBmyh z#%0(2&j4z(v$LKGAj?W@V&eO=4QFH5!rzx*;{lKL8n>S0DM}GW4v#T8IoVMtl+G+J z&fxd^uDGt7Pb3mG1z=!c=g6^R$A7-|*F{;sJB8yoXok(Y>GJq_k!#m)B7o7+Z{)td z-J_L?d(<%UMM)Al89)djJC0Ky|LHgA+Rt*XNjmSMl|33lB_59xi^Z_*D&5@?-^r6d z#!Rz*8l=7IYe92)`O(Yq@#Mg-7yhKMp|iHOhGANSLLqG1M%Q&xsYh(zZZR{nfU0^D zs4)egx3{mQQmKdc?fZII2#-*>lWMI_AP}Hhtx_lyC>G0Pvn6ro&Qc?jd6;f%Q~m+6 z3P3a(Em~Gd$z}^9U0q+cZ`sm@rfImYOSxP|(>Azzb-r#GtBaCkPpc|(z+GVZ?TtXY zEGysoe8F=)J^fz=0>Kv7ZIH|9UM90Zv^Xr1Gs!HuK;6jL7at3{&xTX002ovPDHLkV1lV-bgTdX literal 0 HcwPel00001 diff --git a/kopete/protocols/oscar/icq/CMakeLists.txt b/kopete/protocols/oscar/icq/CMakeLists.txt index 0c4b96a42..f4cafcd19 100644 --- a/kopete/protocols/oscar/icq/CMakeLists.txt +++ b/kopete/protocols/oscar/icq/CMakeLists.txt @@ -40,7 +40,7 @@ ui/icqchangepassword.ui set(kopete_icq_PART_SRCS ${kopete_icq_ui_SRCS} - icqpresence.cpp + icqstatusmanager.cpp icqaccount.cpp icqcontact.cpp aimcontact.cpp diff --git a/kopete/protocols/oscar/icq/aimcontact.cpp b/kopete/protocols/oscar/icq/aimcontact.cpp index e073d951d..e5d5dbb1e 100644 --- a/kopete/protocols/oscar/icq/aimcontact.cpp +++ b/kopete/protocols/oscar/icq/aimcontact.cpp @@ -2,8 +2,8 @@ aimcontact.cpp - Oscar Protocol Plugin Copyright (c) 2003 by Will Stephenson - Copyright (c) 2006 by Roman Jarosz - Kopete (c) 2002-2006 by the Kopete developers + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers ************************************************************************* * * @@ -27,13 +27,14 @@ #include "icqprotocol.h" #include "icqaccount.h" +#include "oscarstatusmanager.h" AIMContact::AIMContact( Kopete::Account* account, const QString& name, Kopete::MetaContact* parent, const QString& icon, const OContact& ssiItem ) : AIMContactBase(account, name, parent, icon, ssiItem ) { mProtocol=static_cast(protocol()); - setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline, ICQ::Presence::AIM ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline, Oscar::Presence::AIM ) ); QObject::connect( mAccount->engine(), SIGNAL( receivedUserInfo( const QString&, const UserDetails& ) ), this, SLOT( userInfoUpdated( const QString&, const UserDetails& ) ) ); @@ -96,7 +97,7 @@ void AIMContact::updateSSIItem() onlineStatus() == Kopete::OnlineStatus::Unknown ) { //make sure they're offline - setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline, ICQ::Presence::AIM ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline, Oscar::Presence::AIM ) ); } } @@ -114,12 +115,12 @@ void AIMContact::userInfoUpdated( const QString& contact, const UserDetails& det setNickName( contact ); kDebug( OSCAR_ICQ_DEBUG ) << k_funcinfo << "extendedStatus is " << details.extendedStatus() << endl; - ICQ::Presence presence = ICQ::Presence::fromOscarStatus( details.extendedStatus(), details.userClass() ); - setOnlineStatus( presence.toOnlineStatus() ); + Oscar::Presence presence = mProtocol->statusManager()->presenceOf( details.extendedStatus(), details.userClass() ); + setPresenceTarget( presence ); - m_mobile = ( presence.flags() & ICQ::Presence::Wireless ); + m_mobile = ( presence.flags() & Oscar::Presence::Wireless ); - if ( presence.type() == ICQ::Presence::Online ) + if ( presence.type() == Oscar::Presence::Online ) { removeProperty( mProtocol->awayMessage ); m_haveAwayMessage = false; @@ -142,7 +143,7 @@ void AIMContact::userOnline( const QString& userId ) return; kDebug(OSCAR_ICQ_DEBUG) << "Setting " << userId << " online" << endl; - setOnlineStatus( ICQ::Presence( ICQ::Presence::Online, ICQ::Presence::AIM ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Online, Oscar::Presence::AIM ) ); } void AIMContact::userOffline( const QString& userId ) @@ -151,7 +152,7 @@ void AIMContact::userOffline( const QString& userId ) return; kDebug(OSCAR_ICQ_DEBUG) << "Setting " << userId << " offline" << endl; - setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline, ICQ::Presence::AIM ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline, Oscar::Presence::AIM ) ); } void AIMContact::slotVisibleTo() diff --git a/kopete/protocols/oscar/icq/icqaccount.cpp b/kopete/protocols/oscar/icq/icqaccount.cpp index 25d8de8be..9c11fff84 100644 --- a/kopete/protocols/oscar/icq/icqaccount.cpp +++ b/kopete/protocols/oscar/icq/icqaccount.cpp @@ -3,7 +3,7 @@ Copyright (c) 2002 by Chris TenHarmsel Copyright (c) 2004 by Richard Smith - Kopete (c) 2002-2004 by the Kopete developers + Kopete (c) 2002-2007 by the Kopete developers ************************************************************************* * * @@ -40,6 +40,8 @@ #include "icqprotocol.h" #include "icqaccount.h" #include "icquserinfowidget.h" +#include "oscarstatusmanager.h" +#include "oscarpresencesdataclasses.h" ICQMyselfContact::ICQMyselfContact( ICQAccount *acct ) : OscarMyselfContact( acct ) { @@ -52,8 +54,11 @@ void ICQMyselfContact::userInfoUpdated() { Oscar::DWORD extendedStatus = details().extendedStatus(); kDebug( OSCAR_ICQ_DEBUG ) << k_funcinfo << "extendedStatus is " << QString::number( extendedStatus, 16 ) << endl; - ICQ::Presence presence = ICQ::Presence::fromOscarStatus( extendedStatus, details().userClass() ); - setOnlineStatus( presence.toOnlineStatus() ); + + ICQProtocol* p = static_cast(protocol()); + Oscar::Presence presence = p->statusManager()->presenceOf( extendedStatus, details().userClass() ); + setOnlineStatus( p->statusManager()->onlineStatusOf( presence ) ); + setProperty( Kopete::Global::Properties::self()->statusMessage(), static_cast( account() )->engine()->statusMessage() ); } @@ -93,7 +98,7 @@ ICQAccount::ICQAccount(Kopete::Protocol *parent, QString accountID) { kDebug(14152) << k_funcinfo << accountID << ": Called."<< endl; setMyself( new ICQMyselfContact( this ) ); - myself()->setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline ).toOnlineStatus() ); + myself()->setOnlineStatus( protocol()->statusManager()->onlineStatusOf( Oscar::Presence( Oscar::Presence::Offline ) ) ); QString nickName = configGroup()->readEntry("NickName", QString() ); mWebAware = configGroup()->readEntry( "WebAware", false ); @@ -126,9 +131,9 @@ ICQProtocol* ICQAccount::protocol() } -ICQ::Presence ICQAccount::presence() +Oscar::Presence ICQAccount::presence() { - return ICQ::Presence::fromOnlineStatus( myself()->onlineStatus() ); + return protocol()->statusManager()->presenceOf( myself()->onlineStatus() ); } @@ -145,9 +150,9 @@ KActionMenu* ICQAccount::actionMenu() KToggleAction* actionInvisible = new KToggleAction( i18n( "In&visible" ), this ); //, "actionInvisible" ); - ICQ::Presence pres( presence().type(), presence().flags() | ICQ::Presence::Invisible ); - actionInvisible->setIcon( KIcon( pres.toOnlineStatus().iconFor( this ) ) ); - actionInvisible->setChecked( (presence().flags() & ICQ::Presence::Invisible) == ICQ::Presence::Invisible ); + Oscar::Presence pres( presence().type(), presence().flags() | Oscar::Presence::Invisible ); + actionInvisible->setIcon( KIcon( protocol()->statusManager()->onlineStatusOf( pres ).iconFor( this ) ) ); + actionInvisible->setChecked( (presence().flags() & Oscar::Presence::Invisible) == Oscar::Presence::Invisible ); QObject::connect( actionInvisible, SIGNAL(triggered(bool)), this, SLOT(slotToggleInvisible()) ); actionMenu->addAction( actionInvisible ); /* @@ -170,8 +175,8 @@ void ICQAccount::connectWithPassword( const QString &password ) //use default online in case of invalid online status for connecting status = Kopete::OnlineStatus( Kopete::OnlineStatus::Online ); - ICQ::Presence pres = ICQ::Presence::fromOnlineStatus( status ); - bool accountIsOffline = ( presence().type() == ICQ::Presence::Offline || + Oscar::Presence pres = protocol()->statusManager()->presenceOf( status ); + bool accountIsOffline = ( presence().type() == Oscar::Presence::Offline || myself()->onlineStatus() == protocol()->statusManager()->connectingStatus() ); if ( accountIsOffline ) @@ -194,12 +199,12 @@ void ICQAccount::connectWithPassword( const QString &password ) oscarSettings->setLastPort( configGroup()->readEntry( "LastPort", 5199 ) ); oscarSettings->setTimeout( configGroup()->readEntry( "Timeout", 10 ) ); //FIXME: also needed for the other call to setStatus (in setPresenceTarget) - Oscar::DWORD status = pres.toOscarStatus(); + Oscar::DWORD status = protocol()->statusManager()->oscarStatusOf( pres ); if ( !mHideIP ) - status |= ICQ::StatusCode::SHOWIP; + status |= Oscar::StatusCode::SHOWIP; if ( mWebAware ) - status |= ICQ::StatusCode::WEBAWARE; + status |= Oscar::StatusCode::WEBAWARE; engine()->setStatus( status, mInitialStatusMessage ); updateVersionUpdaterStamp(); @@ -213,7 +218,8 @@ void ICQAccount::connectWithPassword( const QString &password ) void ICQAccount::disconnected( DisconnectReason reason ) { kDebug(14153) << k_funcinfo << "Attempting to set status offline" << endl; - myself()->setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline, presence().flags() ).toOnlineStatus() ); + Oscar::Presence pres( Oscar::Presence::Offline, presence().flags() ); + myself()->setOnlineStatus( protocol()->statusManager()->onlineStatusOf( pres ) ); QHash contactList = contacts(); foreach( Kopete::Contact* c, contactList ) @@ -224,7 +230,7 @@ void ICQAccount::disconnected( DisconnectReason reason ) if ( oc->ssiItem().waitingAuth() ) oc->setOnlineStatus( protocol()->statusManager()->waitingForAuth() ); else - oc->setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline ).toOnlineStatus() ); + oc->setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline ) ); } } @@ -234,7 +240,7 @@ void ICQAccount::disconnected( DisconnectReason reason ) void ICQAccount::slotToggleInvisible() { - using namespace ICQ; + using namespace Oscar; if ( (presence().flags() & Presence::Invisible) == Presence::Invisible ) setPresenceFlags( presence().flags() & ~Presence::Invisible ); else @@ -294,42 +300,42 @@ void ICQAccount::userReadsStatusMessage( const QString& contact ) notification->sendEvent(); } -void ICQAccount::setPresenceFlags( ICQ::Presence::Flags flags, const QString &message ) +void ICQAccount::setPresenceFlags( Oscar::Presence::Flags flags, const QString &message ) { - ICQ::Presence pres = presence(); + Oscar::Presence pres = presence(); kDebug(OSCAR_ICQ_DEBUG) << k_funcinfo << "new flags=" << (int)flags << ", old type=" << (int)pres.flags() << ", new message=" << message << endl; - setPresenceTarget( ICQ::Presence( pres.type(), flags ), message ); + setPresenceTarget( Oscar::Presence( pres.type(), flags ), message ); } -void ICQAccount::setPresenceType( ICQ::Presence::Type type, const QString &message ) +void ICQAccount::setPresenceType( Oscar::Presence::Type type, const QString &message ) { - ICQ::Presence pres = presence(); + Oscar::Presence pres = presence(); kDebug(OSCAR_ICQ_DEBUG) << k_funcinfo << "new type=" << (int)type << ", old type=" << (int)pres.type() << ", new message=" << message << endl; - setPresenceTarget( ICQ::Presence( type, pres.flags() ), message ); + setPresenceTarget( Oscar::Presence( type, pres.flags() ), message ); } -void ICQAccount::setPresenceTarget( const ICQ::Presence &newPres, const QString &message ) +void ICQAccount::setPresenceTarget( const Oscar::Presence &newPres, const QString &message ) { - bool targetIsOffline = (newPres.type() == ICQ::Presence::Offline); - bool accountIsOffline = ( presence().type() == ICQ::Presence::Offline || + bool targetIsOffline = (newPres.type() == Oscar::Presence::Offline); + bool accountIsOffline = ( presence().type() == Oscar::Presence::Offline || myself()->onlineStatus() == protocol()->statusManager()->connectingStatus() ); if ( targetIsOffline ) { OscarAccount::disconnect(); // allow toggling invisibility when offline - myself()->setOnlineStatus( newPres.toOnlineStatus() ); + myself()->setOnlineStatus( protocol()->statusManager()->onlineStatusOf( newPres ) ); } else if ( accountIsOffline ) { mInitialStatusMessage = message; - OscarAccount::connect( newPres.toOnlineStatus() ); + OscarAccount::connect( protocol()->statusManager()->onlineStatusOf( newPres ) ); } else { - engine()->setStatus( newPres.toOscarStatus(), message ); + engine()->setStatus( protocol()->statusManager()->oscarStatusOf( newPres ), message ); } } @@ -340,20 +346,20 @@ void ICQAccount::setOnlineStatus( const Kopete::OnlineStatus& status, const Kope { // called from outside, i.e. not by our custom action menu entry... - if ( presence().type() == ICQ::Presence::Offline ) + if ( presence().type() == Oscar::Presence::Offline ) { // ...when we are offline go online invisible. - setPresenceTarget( ICQ::Presence( ICQ::Presence::Online, ICQ::Presence::Invisible ) ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Online, Oscar::Presence::Invisible ) ); } else { // ...when we are not offline set invisible. - setPresenceFlags( ICQ::Presence::Invisible ); + setPresenceFlags( Oscar::Presence::Invisible ); } } else { - setPresenceType( ICQ::Presence::fromOnlineStatus( status ).type(), reason.message() ); + setPresenceType( protocol()->statusManager()->presenceOf( status ).type(), reason.message() ); } } diff --git a/kopete/protocols/oscar/icq/icqaccount.h b/kopete/protocols/oscar/icq/icqaccount.h index 9cf86ff3f..33d859342 100644 --- a/kopete/protocols/oscar/icq/icqaccount.h +++ b/kopete/protocols/oscar/icq/icqaccount.h @@ -3,7 +3,7 @@ Copyright (c) 2002 by Chris TenHarmsel Copyright (c) 2004 by Richard Smith - Kopete (c) 2002-2004 by the Kopete developers + Kopete (c) 2002-2007 by the Kopete developers ************************************************************************* * * @@ -22,8 +22,8 @@ #include "oscaraccount.h" #include "oscarmyselfcontact.h" -#include "icqpresence.h" #include "oscartypeclasses.h" +#include "oscarpresence.h" class KAction; namespace Kopete { class AwayAction; class StatusMessage; } @@ -74,11 +74,11 @@ protected slots: private: - ICQ::Presence presence(); + Oscar::Presence presence(); - void setPresenceFlags( ICQ::Presence::Flags flags, const QString &message = QString::null ); - void setPresenceType( ICQ::Presence::Type, const QString &awayMessage = QString::null ); - void setPresenceTarget( const ICQ::Presence &presence, const QString &message = QString::null ); + void setPresenceFlags( Oscar::Presence::Flags flags, const QString &message = QString::null ); + void setPresenceType( Oscar::Presence::Type, const QString &awayMessage = QString::null ); + void setPresenceTarget( const Oscar::Presence &presence, const QString &message = QString::null ); //const unsigned long fullStatus( const unsigned long plainStatus ); diff --git a/kopete/protocols/oscar/icq/icqcontact.cpp b/kopete/protocols/oscar/icq/icqcontact.cpp index 9a57e8c67..d5a08ffc1 100644 --- a/kopete/protocols/oscar/icq/icqcontact.cpp +++ b/kopete/protocols/oscar/icq/icqcontact.cpp @@ -3,9 +3,9 @@ Copyright (c) 2003 by Stefan Gehn Copyright (c) 2003 by Olivier Goffart - Copyright (c) 2006 by Roman Jarosz + Copyright (c) 2006,2007 by Roman Jarosz - Kopete (c) 2003-2006 by the Kopete developers + Kopete (c) 2003-2007 by the Kopete developers ************************************************************************* * * @@ -37,6 +37,8 @@ #include "oscarutils.h" #include "contactmanager.h" +#include "oscarstatusmanager.h" + ICQContact::ICQContact( Kopete::Account* account, const QString &name, Kopete::MetaContact *parent, const QString& icon, const OContact& ssiItem ) @@ -48,7 +50,7 @@ ICQContact::ICQContact( Kopete::Account* account, const QString &name, Kopete::M if ( ssiItem.waitingAuth() ) setOnlineStatus( mProtocol->statusManager()->waitingForAuth() ); else - setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline ) ); QObject::connect( mAccount->engine(), SIGNAL( loggedIn() ), this, SLOT( loggedIn() ) ); //QObject::connect( mAccount->engine(), SIGNAL( userIsOnline( const QString& ) ), this, SLOT( userOnline( const QString&, UserDetails ) ) ); @@ -78,7 +80,7 @@ void ICQContact::updateSSIItem() onlineStatus() == Kopete::OnlineStatus::Unknown ) { //make sure they're offline - setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline ) ); } } @@ -94,12 +96,19 @@ void ICQContact::userInfoUpdated( const QString& contact, const UserDetails& det removeProperty( mProtocol->awayMessage ); kDebug( OSCAR_ICQ_DEBUG ) << k_funcinfo << "extendedStatus is " << details.extendedStatus() << endl; - ICQ::Presence presence = ICQ::Presence::fromOscarStatus( details.extendedStatus(), details.userClass() ); - setOnlineStatus( presence.toOnlineStatus() ); + Oscar::Presence presence = mProtocol->statusManager()->presenceOf( details.extendedStatus(), details.userClass() ); + + if ( details.xtrazStatusSpecified() ) + { + presence.setFlags( presence.flags() | Oscar::Presence::XStatus ); + presence.setDescription( i18n("Online") ); + presence.setIcon( QString( "icq_xstatus%1" ).arg( details.xtrazStatus() ) ); + } + setPresenceTarget( presence ); - ICQ::Presence selfPres( ICQ::Presence::fromOnlineStatus( account()->myself()->onlineStatus() ) ); - bool selfVisible = !(selfPres.flags() & ICQ::Presence::Invisible); - if ( presence.type() == ICQ::Presence::Online ) + Oscar::Presence selfPres( mProtocol->statusManager()->presenceOf( account()->myself()->onlineStatus() ) ); + bool selfVisible = !(selfPres.flags() & Oscar::Presence::Invisible); + if ( presence.type() == Oscar::Presence::Online ) { if ( details.xtrazStatusSpecified() ) { @@ -120,19 +129,19 @@ void ICQContact::userInfoUpdated( const QString& contact, const UserDetails& det { switch ( presence.type() ) { - case ICQ::Presence::Away: + case Oscar::Presence::Away: mAccount->engine()->addICQAwayMessageRequest( contactId(), Client::ICQAway ); break; - case ICQ::Presence::NotAvailable: + case Oscar::Presence::NotAvailable: mAccount->engine()->addICQAwayMessageRequest( contactId(), Client::ICQNotAvailable ); break; - case ICQ::Presence::Occupied: + case Oscar::Presence::Occupied: mAccount->engine()->addICQAwayMessageRequest( contactId(), Client::ICQOccupied ); break; - case ICQ::Presence::DoNotDisturb: + case Oscar::Presence::DoNotDisturb: mAccount->engine()->addICQAwayMessageRequest( contactId(), Client::ICQDoNotDisturb ); break; - case ICQ::Presence::FreeForChat: + case Oscar::Presence::FreeForChat: mAccount->engine()->addICQAwayMessageRequest( contactId(), Client::ICQFreeForChat ); break; default: @@ -171,7 +180,7 @@ void ICQContact::userOnline( const QString& userId ) return; kDebug(OSCAR_ICQ_DEBUG) << "Setting " << userId << " online" << endl; - setOnlineStatus( ICQ::Presence( ICQ::Presence::Online ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Online ) ); } void ICQContact::userOffline( const QString& userId ) @@ -183,7 +192,7 @@ void ICQContact::userOffline( const QString& userId ) if ( m_ssiItem.waitingAuth() ) setOnlineStatus( mProtocol->statusManager()->waitingForAuth() ); else - setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline ) ); removeProperty( mProtocol->awayMessage ); } @@ -241,7 +250,7 @@ void ICQContact::slotGotAuthReply( const QString& contact, const QString& reason reason ); // remove the unknown status - setOnlineStatus( ICQ::Presence( ICQ::Presence::Offline ).toOnlineStatus() ); + setPresenceTarget( Oscar::Presence( Oscar::Presence::Offline ) ); } else { diff --git a/kopete/protocols/oscar/icq/icqpresence.cpp b/kopete/protocols/oscar/icq/icqpresence.cpp deleted file mode 100644 index 6cc8e79ef..000000000 --- a/kopete/protocols/oscar/icq/icqpresence.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/* - icqpresence.cpp - ICQ online status and presence management - - Copyright (c) 2004 by Richard Smith - Copyright (c) 2007 by Roman Jarosz - Kopete (c) 2002-2007 by the Kopete developers - - ************************************************************************* - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ************************************************************************* -*/ - -#include -#include - -#include -#include -#include - -#include -#include - -#include "icqprotocol.h" - -#include "icqpresence.h" - -namespace ICQ -{ - -//BEGIN class PresenceOverlay - -class PresenceOverlay -{ -public: - PresenceOverlay() : mFlags( Presence::None ) {} - PresenceOverlay( Presence::Flags flags, QString name, QStringList icons ) - : mFlags(flags), mName(name), mIcons(icons) {} - - static PresenceOverlay createForFlags( Presence::Flags flags ); - - Presence::Flags overlayFlag() const { return mFlags; } - QString overlayName() const { return mName; } - QStringList overlayIcons() const { return mIcons; } - - PresenceOverlay &operator+= ( const PresenceOverlay &other ); - -private: - Presence::Flags mFlags; - QString mName; - QStringList mIcons; -}; - -PresenceOverlay PresenceOverlay::createForFlags( Presence::Flags flags ) -{ - /** - * Here are defined all available overlays. We can define overlay for one Presence::Flags - * or for combination of Presence::Flags. If a flags argument in this function is combination - * of flags than a PresenceOverlay object is created from combination of defined overlays or - * if the combination is defined separately than we return that PresenceOverlay object. - */ - - const int dataSize = 3; - static const PresenceOverlay data[dataSize] = - { - PresenceOverlay( Presence::Invisible, i18n("Invisible"), QStringList(QString("contact_invisible_overlay")) ), - PresenceOverlay( Presence::Wireless, i18n("Mobile"), QStringList(QString("contact_phone_overlay")) ), - PresenceOverlay( Presence::AIM, i18n("AIM"), QStringList(QString("aim_overlay")) ) - }; - - PresenceOverlay overlay; - for ( int n = 0; n < dataSize; ++n ) - { - if ( data[n].overlayFlag() == flags ) - return data[n]; - else if ( data[n].overlayFlag() & flags ) - overlay += data[n]; - } - - return overlay; -} - -PresenceOverlay &PresenceOverlay::operator+=( const PresenceOverlay &other ) -{ - mFlags |= other.mFlags; - if ( mName.isEmpty() ) - mName = other.mName; - else if ( !other.mName.isEmpty() ) - mName += QString( ", " ) + other.mName; - - mIcons << other.mIcons; - return *this; -} - -//END class PresenceOverlay - - -//BEGIN struct PresenceTypeData - -typedef QList FlagsList; -struct PresenceTypeData -{ - Presence::Type type; - Kopete::OnlineStatus::StatusType onlineStatusType; - unsigned long setFlag; - unsigned long getFlag; - QString caption; - QString name; - QStringList overlayIcons; - Kopete::OnlineStatusManager::Categories categories; - Kopete::OnlineStatusManager::Options options; - FlagsList overlayFlagsList; - - static const PresenceTypeData *all(); - static const PresenceTypeData &forType( Presence::Type type ); - static const PresenceTypeData &forStatus( unsigned long status ); - static const PresenceTypeData &forOnlineStatusType( const Kopete::OnlineStatus::StatusType statusType ); -}; - -const PresenceTypeData *PresenceTypeData::all() -{ - using namespace Kopete; - using namespace ICQ::StatusCode; - /** - * The order here is important - this is the order the IS_XXX flags will be checked for in. - * That, in particular, means that NA, Occupied and DND must appear before Away, and that - * DND must appear before Occupied. Offline (testing all bits) must go first, and Online - * (testing no bits - will always match a status) must go last. - * - * Free For Chat is currently listed after Away, since if someone is Away + Free For Chat we - * want to show them as Away more than we want to show them FFC. - * - * OverlayFlagsList should contain all possible flags combinations that can occur in ICQ protocol. - * If overlayFlagsList contains flag None than this KOS will be in account's context menu. - */ - static const PresenceTypeData data[] = - { - { Presence::Offline, OnlineStatus::Offline, OFFLINE, OFFLINE, i18n( "O&ffline" ), i18n("Offline"), QStringList(), Kopete::OnlineStatusManager::Offline, 0, FlagsList() << Presence::None << Presence::AIM << Presence::Invisible }, - - { Presence::DoNotDisturb, OnlineStatus::Away, SET_DND, IS_DND, i18n( "&Do Not Disturb" ), i18n("Do Not Disturb"), QStringList(QString("contact_busy_overlay")), Kopete::OnlineStatusManager::Busy, Kopete::OnlineStatusManager::HasStatusMessage, FlagsList() << Presence::None << Presence::Invisible << Presence::Wireless << (Presence::Wireless | Presence::Invisible) }, - - { Presence::Occupied, OnlineStatus::Away, SET_OCC, IS_OCC, i18n( "O&ccupied" ), i18n("Occupied"), QStringList(QString("contact_busy_overlay")), 0, Kopete::OnlineStatusManager::HasStatusMessage, FlagsList() << Presence::None << Presence::Invisible }, - - { Presence::NotAvailable, OnlineStatus::Away, SET_NA, IS_NA, i18n( "Not A&vailable" ), i18n("Not Available"), QStringList(QString("contact_xa_overlay")), Kopete::OnlineStatusManager::ExtendedAway, Kopete::OnlineStatusManager::HasStatusMessage, FlagsList() << Presence::None << Presence::Invisible }, - - { Presence::Away, OnlineStatus::Away, SET_AWAY, IS_AWAY, i18n( "&Away" ), i18n("Away"), QStringList(QString("contact_away_overlay")), Kopete::OnlineStatusManager::Away, Kopete::OnlineStatusManager::HasStatusMessage, FlagsList() << Presence::None << Presence::Invisible << Presence::AIM << (Presence::AIM | Presence::Invisible) << Presence::Wireless << (Presence::Wireless | Presence::Invisible) }, - - { Presence::FreeForChat, OnlineStatus::Online, SET_FFC, IS_FFC, i18n( "&Free for Chat" ), i18n("Free For Chat"), QStringList(QString("icq_ffc")), Kopete::OnlineStatusManager::FreeForChat, 0, FlagsList() << Presence::None << (Presence::None | Presence::Invisible) }, - - { Presence::Online, OnlineStatus::Online, ONLINE, ONLINE, i18n( "O&nline" ), i18n("Online"), QStringList(), Kopete::OnlineStatusManager::Online, 0, FlagsList() << Presence::None << Presence::Invisible << Presence::AIM << (Presence::AIM | Presence::Invisible) << Presence::Wireless << (Presence::Wireless | Presence::Invisible) } - }; - return data; -} - -const PresenceTypeData &PresenceTypeData::forType( Presence::Type type ) -{ - const PresenceTypeData *array = all(); - for ( uint n = 0; n < Presence::TypeCount; ++n ) - if ( array[n].type == type ) - return array[n]; - kWarning(14153) << k_funcinfo << "type " << (int)type << " not found! Returning Offline" << endl; - return array[0]; -} - -const PresenceTypeData &PresenceTypeData::forStatus( unsigned long status ) -{ - const PresenceTypeData *array = all(); - for ( uint n = 0; n < Presence::TypeCount; ++n ) - { - if ( (array[n].getFlag & status) == array[n].getFlag ) - return array[n]; - } - kWarning(14153) << k_funcinfo << "status " << (int)status << " not found! Returning Offline. This should not happen." << endl; - return array[0]; -} - -const PresenceTypeData &PresenceTypeData::forOnlineStatusType( const Kopete::OnlineStatus::StatusType statusType ) -{ - const PresenceTypeData *array = all(); - for ( int n = Presence::TypeCount - 1; n >= 0; --n ) - { - if ( array[n].onlineStatusType == statusType ) - return array[n]; - } - kWarning(14153) << k_funcinfo << "online status " << (int)statusType << " not found! Returning Offline. This should not happen." << endl; - return array[0]; -} - -//END struct PresenceTypeData - -//BEGIN class OnlineStatusManager - -class OnlineStatusManager::Private -{ -public: - typedef QHash StatusHash; - - // connecting and unknown should have the same internal status as offline, so converting to a Presence gives an Offline one - Private() - : connecting( Kopete::OnlineStatus::Connecting, 99, ICQProtocol::protocol(), - 99, QStringList(QString("icq_connecting")), i18n("Connecting...") ) - , unknown( Kopete::OnlineStatus::Unknown, 0, ICQProtocol::protocol(), - Presence::Offline, QStringList(QString("status_unknown")), i18n("Unknown") ) - , waitingForAuth( Kopete::OnlineStatus::Unknown, 1, ICQProtocol::protocol(), - Presence::Offline, QStringList(QString("button_cancel")), i18n("Waiting for Authorization") ) - , invisible( Kopete::OnlineStatus::Invisible, 2, ICQProtocol::protocol(), - Presence::Offline, QStringList(), QString(), - QString(), Kopete::OnlineStatusManager::Invisible, - Kopete::OnlineStatusManager::HideFromMenu ) - - { - //weight 0, 1 and 2 are used by KOS unknown, waitingForAuth and invisible - const uint firstUsableWeight = 3; - for ( uint i = 0; i < Presence::TypeCount; ++i ) - { - const PresenceTypeData &data = PresenceTypeData::forType( static_cast(i) ); - const uint weight = i + firstUsableWeight; - for ( int j = 0; j < data.overlayFlagsList.count(); ++j ) - { - const uint internalStatus = data.overlayFlagsList.at(j) | data.type; - - Kopete::OnlineStatus status; - if ( data.overlayFlagsList.at(j) != Presence::None ) - { - PresenceOverlay overlay = PresenceOverlay::createForFlags( data.overlayFlagsList.at(j) ); - //don't add KOS to account's context menu - status = Kopete::OnlineStatus( data.onlineStatusType, weight, - ICQProtocol::protocol(), internalStatus, - data.overlayIcons + overlay.overlayIcons(), - data.name + QString(" (%1)").arg( overlay.overlayName() ) ); - } - else - { - //add KOS - status = Kopete::OnlineStatus( data.onlineStatusType, weight, - ICQProtocol::protocol(), internalStatus, - data.overlayIcons, data.name, - data.caption, data.categories, data.options ); - } - statusHash[internalStatus] = status; - } - } - } - - StatusHash statusHash; - Kopete::OnlineStatus connecting; - Kopete::OnlineStatus unknown; - Kopete::OnlineStatus waitingForAuth; - Kopete::OnlineStatus invisible; -}; - -OnlineStatusManager::OnlineStatusManager() - : d( new Private ) -{ -} - -OnlineStatusManager::~OnlineStatusManager() -{ - delete d; -} - -Kopete::OnlineStatus OnlineStatusManager::onlineStatusOf( const Presence &presence ) -{ - if ( d->statusHash.contains( presence.internalStatus() ) ) - { - return d->statusHash.value( presence.internalStatus() ); - } - else if ( d->statusHash.contains( presence.type() ) ) - { - kWarning() << k_funcinfo << "Kopete::OnlineStatus doesn't exists for internal status" << presence.internalStatus() - << "Using basic status for type" << presence.type() << endl; - return d->statusHash.value( presence.type() ); - } - else - { - kWarning() << k_funcinfo << "Kopete::OnlineStatus doesn't exists for internal status" << presence.internalStatus() << endl; - return d->unknown; - } -} - -Kopete::OnlineStatus OnlineStatusManager::connectingStatus() -{ - return d->connecting; -} - -Kopete::OnlineStatus OnlineStatusManager::unknownStatus() -{ - return d->unknown; -} - -Kopete::OnlineStatus OnlineStatusManager::waitingForAuth() -{ - return d->waitingForAuth; -} - -//END class OnlineStatusManager - -//BEGIN class Presence - -Presence::Presence( Type type, Flags flags ) -{ - _internalStatus = type | flags; -} - -Presence::Presence( uint internalStatus ) -{ - _internalStatus = internalStatus; -} - -Presence Presence::fromOnlineStatus( const Kopete::OnlineStatus &status ) -{ - if ( status.protocol() == ICQProtocol::protocol() ) - { - return Presence( status.internalStatus() ); - } - else - { - //status is a libkopete builtin status object - //don't even think about converting it to ICQ::Presence using presenceOf! - return Presence( PresenceTypeData::forOnlineStatusType( status.status() ).type, - Presence::None ); - } -} - -Kopete::OnlineStatus Presence::toOnlineStatus() const -{ - OnlineStatusManager *store = ICQProtocol::protocol()->statusManager(); - return store->onlineStatusOf( *this ); -} - - -unsigned long Presence::toOscarStatus() const -{ - unsigned long basicStatus = basicOscarStatus(); - if ( (_internalStatus & Invisible) == Invisible ) - basicStatus |= StatusCode::INVISIBLE; - return basicStatus; -} - -Presence Presence::fromOscarStatus( unsigned long oStatus, int oClass ) -{ - Type type = typeFromOscarStatus( oStatus ); - - //Hack for aim away contacts - if ( type == Online && (oClass & ClassCode::AWAY) == ClassCode::AWAY ) - type = Away; - - Flags flags = None; - if ( (oClass & ClassCode::ICQ) == ClassCode::ICQ ) - flags |= None; - else - flags |= AIM; - - if ( (oClass & ClassCode::WIRELESS) == ClassCode::WIRELESS ) - flags |= Wireless; - - if ( (oStatus & StatusCode::INVISIBLE) == StatusCode::INVISIBLE ) - flags |= Invisible; - - return Presence( type, flags ); -} - -unsigned long Presence::basicOscarStatus() const -{ - const PresenceTypeData &data = PresenceTypeData::forType( type() ); - return data.setFlag; -} - -Presence::Type Presence::typeFromOscarStatus( unsigned long status ) -{ - const PresenceTypeData &data = PresenceTypeData::forStatus( status & 0xff ); - return data.type; -} - -//END class Presence - -} // end namespace ICQ - -// vim: set noet ts=4 sts=4 sw=4: -// kate: indent-mode: csands; space-indent off; tab-width 4; diff --git a/kopete/protocols/oscar/icq/icqpresence.h b/kopete/protocols/oscar/icq/icqpresence.h deleted file mode 100644 index 41fac147f..000000000 --- a/kopete/protocols/oscar/icq/icqpresence.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - icqpresence.h - ICQ online status and presence management - - Copyright (c) 2004 by Richard Smith - Copyright (c) 2007 by Roman Jarosz - Kopete (c) 2002-2007 by the Kopete developers - - ************************************************************************* - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ************************************************************************* -*/ - - -#ifndef ICQPRESENCE_H -#define ICQPRESENCE_H - -#include - -namespace Kopete { class OnlineStatus; } - -namespace ICQ -{ - -class Presence; - -/** - * @brief This namespace contains status flags used in OSCAR's on-the-wire format. - * - * The IS_XXX values are bits representing actual status flags. However, the flags - * are just that -- flags. ICQ statuses are represented by a combination of these - * flags rather than just one value. This seems to be for backwards compatibility - * reasons -- this way you can add a new status and existing clients should still - * work correctly. - * - * So, when changing status you need to specify not only what status it is, but - * also all other status flags that are appropriate. The SET_XXX flags do just that; - * SET_DND for instance sets the DND, Occupied and Away bits. - */ -namespace StatusCode -{ - enum - { - OFFLINE = 0xFFFFFFFF, - ONLINE = 0x00000000, - INVISIBLE = 0x00000100, - - IS_DND = 0x00000002, ///< Do Not Disturb - IS_OCC = 0x00000010, ///< Occupied - IS_NA = 0x00000004, ///< Not Available - IS_AWAY = 0x00000001, ///< Away - IS_FFC = 0x00000020, ///< Free For Chat - - SET_DND = 0x00000013, //== DND + Occupied + Away - SET_OCC = 0x00000011, //== Occupied + Away - SET_NA = 0x00000005, //== NA + Away - SET_AWAY = 0x00000001, - SET_FFC = 0x00000020, - - WEBAWARE = 0x00010000, - SHOWIP = 0x00020000 - }; -} // end namespace StatusCode - -namespace ClassCode -{ - enum - { - AWAY = 0x0020, - ICQ = 0x0040, - WIRELESS = 0x0080 - }; -} // end namespace ClassCode - -/** - * @brief A manager for ICQ's online statuses - * - * Looks after ICQ's numerous online statuses, and maps between them and Presence objects. - * A single instance of this class is held by the ICQProtocol object. - */ -class OnlineStatusManager -{ -public: - OnlineStatusManager(); - ~OnlineStatusManager(); - - Kopete::OnlineStatus onlineStatusOf( const ICQ::Presence &presence ); - Kopete::OnlineStatus connectingStatus(); - Kopete::OnlineStatus unknownStatus(); - Kopete::OnlineStatus waitingForAuth(); - -private: - class Private; - Private *d; -}; - -/** - * @brief An ICQ online presence object - */ -class Presence -{ -public: - /** - * Friendly types this status can be - */ - enum Type { Offline = 0x000, DoNotDisturb = 0x001, Occupied = 0x002, - NotAvailable = 0x003, Away = 0x004, FreeForChat = 0x005, Online = 0x006 }; - enum { TypeCount = Online + 1 }; - - enum Flag { None = 0x000, AIM = 0x010, ICQ = 0x020, Wireless = 0x100, Invisible = 0x200 }; - Q_DECLARE_FLAGS(Flags, Flag) - - Presence( Type type, Flags flags = None ); - - Type type() const { return (Type)(_internalStatus & 0x0000000F); } - Flags flags() const { return (Flags)(_internalStatus & 0xFFFFFFF0); } - uint internalStatus() const { return _internalStatus; } - - /** - * Generate a Presence object from an online status - */ - static Presence fromOnlineStatus( const Kopete::OnlineStatus &status ); - - /** - * Convert this Presence object to an online status - */ - Kopete::OnlineStatus toOnlineStatus() const; - - /** - * Get the status code to pass to liboscar to set us to this Status. - * @note This is not the opposite of fromOnlineStatus(). The set and get codes don't match. - */ - unsigned long toOscarStatus() const; - - /** - * Get the status a contact is at based on liboscar's view of its status. - * @note This is not the opposite of toOnlineStatus(). - */ - static Presence fromOscarStatus( unsigned long oStatus, int oClass ); - - bool operator==( const Presence &other ) const { return other._internalStatus == _internalStatus; } - bool operator!=( const Presence &other ) const { return !(*this == other); } - -private: - Presence( uint internalStatus ); - - unsigned long basicOscarStatus() const; - static Type typeFromOscarStatus( unsigned long status ); -private: - uint _internalStatus; - -}; -Q_DECLARE_OPERATORS_FOR_FLAGS(Presence::Flags) -} - -#endif -// vim: set noet ts=4 sts=4 sw=4: -// kate: indent-mode: csands diff --git a/kopete/protocols/oscar/icq/icqprotocol.cpp b/kopete/protocols/oscar/icq/icqprotocol.cpp index 372310f74..8f86d8888 100644 --- a/kopete/protocols/oscar/icq/icqprotocol.cpp +++ b/kopete/protocols/oscar/icq/icqprotocol.cpp @@ -38,6 +38,7 @@ #include "icqeditaccountwidget.h" #include "icqprotocol.h" +#include "icqstatusmanager.h" typedef KGenericFactory ICQProtocolFactory; K_EXPORT_COMPONENT_FACTORY( kopete_icq, ICQProtocolFactory( "kopete_icq" ) ) @@ -160,7 +161,7 @@ ICQProtocol::ICQProtocol(QObject *parent, const QStringList&) protocolStatic_ = this; // must be done after protocolStatic_ is set... - statusManager_ = new ICQ::OnlineStatusManager; + statusManager_ = new ICQStatusManager; addAddressBookField("messaging/icq", Kopete::Plugin::MakeIndexField); @@ -828,7 +829,7 @@ Kopete::Account *ICQProtocol::createNewAccount(const QString &accountId) return new ICQAccount(this, accountId); } -ICQ::OnlineStatusManager *ICQProtocol::statusManager() +OscarStatusManager *ICQProtocol::statusManager() const { return statusManager_; } diff --git a/kopete/protocols/oscar/icq/icqprotocol.h b/kopete/protocols/oscar/icq/icqprotocol.h index 96dee84bc..0357f734c 100644 --- a/kopete/protocols/oscar/icq/icqprotocol.h +++ b/kopete/protocols/oscar/icq/icqprotocol.h @@ -20,14 +20,9 @@ #include "oscarprotocol.h" #include "kopetemimetypehandler.h" -// #include "kopeteonlinestatus.h" -// #include "kopetecontactproperty.h" class QComboBox; -/*class ICQUserInfoWidget; -class ICQContact;*/ - -namespace ICQ { class OnlineStatusManager; } +class ICQStatusManager; class ICQProtocolHandler : public Kopete::MimeTypeHandler { @@ -56,7 +51,7 @@ public: KopeteEditAccountWidget *createEditAccountWidget(Kopete::Account *account, QWidget *parent); Kopete::Account *createNewAccount(const QString &accountId); - ICQ::OnlineStatusManager *statusManager(); + OscarStatusManager *statusManager() const; const Kopete::ContactPropertyTmpl firstName; @@ -94,7 +89,7 @@ private: private: static ICQProtocol* protocolStatic_; - ICQ::OnlineStatusManager* statusManager_; + ICQStatusManager* statusManager_; QMap mGenders; QMap mCountries; QMap mLanguages; diff --git a/kopete/protocols/oscar/icq/icqstatusmanager.cpp b/kopete/protocols/oscar/icq/icqstatusmanager.cpp new file mode 100644 index 000000000..bb467d9d3 --- /dev/null +++ b/kopete/protocols/oscar/icq/icqstatusmanager.cpp @@ -0,0 +1,114 @@ +/* + icqstatusmanager.cpp - ICQ Status Manager + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include "icqstatusmanager.h" + +#include + +#include "icqprotocol.h" +#include "oscarpresencesdataclasses.h" + +class ICQStatusManager::Private +{ +public: + // connecting and unknown should have the same internal status as offline, so converting to a Presence gives an Offline one + Private() + : connecting( Kopete::OnlineStatus::Connecting, 99, ICQProtocol::protocol(), + 99, QStringList(QString("icq_connecting")), i18n("Connecting...") ) + , unknown( Kopete::OnlineStatus::Unknown, 0, ICQProtocol::protocol(), + Oscar::Presence::Offline, QStringList(QString("status_unknown")), i18n("Unknown") ) + , waitingForAuth( Kopete::OnlineStatus::Unknown, 1, ICQProtocol::protocol(), + Oscar::Presence::Offline, QStringList(QString("button_cancel")), i18n("Waiting for Authorization") ) + , invisible( Kopete::OnlineStatus::Invisible, 2, ICQProtocol::protocol(), + Oscar::Presence::Offline, QStringList(), QString(), + QString(), Kopete::OnlineStatusManager::Invisible, + Kopete::OnlineStatusManager::HideFromMenu ) + + { + } + + Kopete::OnlineStatus connecting; + Kopete::OnlineStatus unknown; + Kopete::OnlineStatus waitingForAuth; + Kopete::OnlineStatus invisible; +}; + +ICQStatusManager::ICQStatusManager() + : OscarStatusManager( ICQProtocol::protocol() ), d( new Private ) +{ + using namespace Oscar; + using namespace Kopete; + using namespace StatusCode; + + /** + * The order here is important - this is the order the IS_XXX flags will be checked for in. + * That, in particular, means that NA, Occupied and DND must appear before Away, and that + * DND must appear before Occupied. Offline (testing all bits) must go first, and Online + * (testing no bits - will always match a status) must go last. + * + * Free For Chat is currently listed after Away, since if someone is Away + Free For Chat we + * want to show them as Away more than we want to show them FFC. + */ + + QList data; + + data << PresenceType( Presence::Offline, OnlineStatus::Offline, OFFLINE, OFFLINE, i18n( "O&ffline" ), i18n("Offline"), QStringList(), Kopete::OnlineStatusManager::Offline, 0, PresenceType::FlagsList() << Presence::None << Presence::AIM << Presence::Invisible ); + + data << PresenceType( Presence::DoNotDisturb, OnlineStatus::Away, SET_DND, IS_DND, i18n( "&Do Not Disturb" ), i18n("Do Not Disturb"), QStringList(QString("contact_busy_overlay")), Kopete::OnlineStatusManager::Busy, Kopete::OnlineStatusManager::HasStatusMessage, PresenceType::FlagsList() << Presence::None << Presence::Invisible << Presence::Wireless << (Presence::Wireless | Presence::Invisible) ); + + data << PresenceType( Presence::Occupied, OnlineStatus::Away, SET_OCC, IS_OCC, i18n( "O&ccupied" ), i18n("Occupied"), QStringList(QString("contact_busy_overlay")), 0, Kopete::OnlineStatusManager::HasStatusMessage, PresenceType::FlagsList() << Presence::None << Presence::Invisible ); + + data << PresenceType( Presence::NotAvailable, OnlineStatus::Away, SET_NA, IS_NA, i18n( "Not A&vailable" ), i18n("Not Available"), QStringList(QString("contact_xa_overlay")), Kopete::OnlineStatusManager::ExtendedAway, Kopete::OnlineStatusManager::HasStatusMessage, PresenceType::FlagsList() << Presence::None << Presence::Invisible ); + + data << PresenceType( Presence::Away, OnlineStatus::Away, SET_AWAY, IS_AWAY, i18n( "&Away" ), i18n("Away"), QStringList(QString("contact_away_overlay")), Kopete::OnlineStatusManager::Away, Kopete::OnlineStatusManager::HasStatusMessage, PresenceType::FlagsList() << Presence::None << Presence::Invisible << Presence::AIM << (Presence::AIM | Presence::Invisible) << Presence::Wireless << (Presence::Wireless | Presence::Invisible) ); + + data << PresenceType( Presence::FreeForChat, OnlineStatus::Online, SET_FFC, IS_FFC, i18n( "&Free for Chat" ), i18n("Free For Chat"), QStringList(QString("icq_ffc")), Kopete::OnlineStatusManager::FreeForChat, 0, PresenceType::FlagsList() << Presence::None << Presence::Invisible ); + + data << PresenceType( Presence::Online, OnlineStatus::Online, ONLINE, ONLINE, i18n( "O&nline" ), i18n("Online"), QStringList(), Kopete::OnlineStatusManager::Online, 0, PresenceType::FlagsList() << Presence::None << Presence::Invisible << Presence::AIM << (Presence::AIM | Presence::Invisible) << Presence::Wireless << (Presence::Wireless | Presence::Invisible) ); + + setPresenceType( data ); + + QList overlay; + overlay << PresenceOverlay( Presence::Invisible, i18n("Invisible"), QStringList(QString("contact_invisible_overlay")) ); + overlay << PresenceOverlay( Presence::Wireless, i18n("Mobile"), QStringList(QString("contact_phone_overlay")) ); + overlay << PresenceOverlay( Presence::AIM, i18n("AIM"), QStringList(QString("aim_overlay")) ); + setPresenceOverlay( overlay ); + + setPresenceFlagsMask( ~(Presence::Flags)Presence::ICQ ); + //weight 0, 1 and 2 are used by KOS unknown, waitingForAuth and invisible + initialize( 3 ); +} + +ICQStatusManager::~ICQStatusManager() +{ + delete d; +} + +Kopete::OnlineStatus ICQStatusManager::connectingStatus() const +{ + return d->connecting; +} + +Kopete::OnlineStatus ICQStatusManager::unknownStatus() const +{ + return d->unknown; +} + +Kopete::OnlineStatus ICQStatusManager::waitingForAuth() const +{ + return d->waitingForAuth; +} diff --git a/kopete/protocols/oscar/icq/icqstatusmanager.h b/kopete/protocols/oscar/icq/icqstatusmanager.h new file mode 100644 index 000000000..ebe3fb665 --- /dev/null +++ b/kopete/protocols/oscar/icq/icqstatusmanager.h @@ -0,0 +1,48 @@ +/* + icqstatusmanager.h - ICQ Status Manager + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + + +#ifndef ICQSTATUSMANAGER_H +#define ICQSTATUSMANAGER_H + +#include "oscarstatusmanager.h" + +namespace Kopete { class OnlineStatus; } + +/** + * @brief A manager for ICQ's online statuses + * + * Looks after ICQ's numerous online statuses, and maps between them and Presence objects. + * A single instance of this class is held by the ICQProtocol object. + */ +class ICQStatusManager : public OscarStatusManager +{ +public: + ICQStatusManager(); + ~ICQStatusManager(); + + virtual Kopete::OnlineStatus connectingStatus() const; + virtual Kopete::OnlineStatus unknownStatus() const; + virtual Kopete::OnlineStatus waitingForAuth() const; + +private: + class Private; + Private *d; +}; + +#endif + diff --git a/kopete/protocols/oscar/icqcontactbase.cpp b/kopete/protocols/oscar/icqcontactbase.cpp index d56a6e5fc..a095dcd24 100644 --- a/kopete/protocols/oscar/icqcontactbase.cpp +++ b/kopete/protocols/oscar/icqcontactbase.cpp @@ -3,8 +3,8 @@ Copyright (c) 2003 by Stefan Gehn Copyright (c) 2003 by Olivier Goffart - Copyright (c) 2006 by Roman Jarosz - Kopete (c) 2003-2006 by the Kopete developers + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2003-2007 by the Kopete developers ************************************************************************* * * @@ -22,6 +22,9 @@ #include "oscaraccount.h" #include "oscarutils.h" +#include "oscarpresence.h" +#include "oscarprotocol.h" +#include "oscarstatusmanager.h" ICQContactBase::ICQContactBase( Kopete::Account *account, const QString &name, Kopete::MetaContact *parent, @@ -84,9 +87,14 @@ void ICQContactBase::receivedXStatusMessage( const QString& contact, int icon, c if ( Oscar::normalize( contact ) != Oscar::normalize( contactId() ) ) return; - // TODOL create OnlineStatus with icon and title + OscarProtocol* p = static_cast(protocol()); + Oscar::Presence presence = p->statusManager()->presenceOf( this->onlineStatus() ); + presence.setFlags( presence.flags() | Oscar::Presence::XStatus ); + presence.setDescription( title ); + presence.setIcon( QString( "icq_xstatus%1" ).arg( icon ) ); + setPresenceTarget( presence ); + setAwayMessage( desc ); - m_haveAwayMessage = true; } diff --git a/kopete/protocols/oscar/oscarcontact.cpp b/kopete/protocols/oscar/oscarcontact.cpp index 4ea1a2c88..a4133aa7d 100644 --- a/kopete/protocols/oscar/oscarcontact.cpp +++ b/kopete/protocols/oscar/oscarcontact.cpp @@ -48,6 +48,7 @@ #include "oscarutils.h" #include "oscarprotocol.h" #include "oscarencodingselectiondialog.h" +#include "oscarstatusmanager.h" #include @@ -281,6 +282,12 @@ bool OscarContact::hasCap( int capNumber ) const return m_details.hasCap( capNumber ); } +void OscarContact::setPresenceTarget( const Oscar::Presence &presence ) +{ + OscarProtocol* p = static_cast(protocol()); + setOnlineStatus( p->statusManager()->onlineStatusOf( presence ) ); +} + //here's where a filetransfer usually begins //could be called by a KAction or our dcop code or something void OscarContact::sendFile( const KUrl &sourceURL, const QString &altFileName, uint fileSize ) diff --git a/kopete/protocols/oscar/oscarcontact.h b/kopete/protocols/oscar/oscarcontact.h index d8b12a092..5ab2e57d9 100644 --- a/kopete/protocols/oscar/oscarcontact.h +++ b/kopete/protocols/oscar/oscarcontact.h @@ -35,6 +35,11 @@ class ChatSession; class OnlineStatus; } +namespace Oscar +{ +class Presence; +} + class OscarAccount; class QTimer; class QTextCodec; @@ -98,6 +103,12 @@ public: */ bool hasCap( int capNumber ) const; + /** + * Set presence target + * Helper function that converts Oscar::Presence to Kopete::OnlineStatus and sets OnlineStatus. + */ + void setPresenceTarget( const Oscar::Presence &presence ); + virtual QString sanitizedMessage( const QString& message ) = 0; public slots: diff --git a/kopete/protocols/oscar/oscarpresence.cpp b/kopete/protocols/oscar/oscarpresence.cpp new file mode 100644 index 000000000..dbef123e5 --- /dev/null +++ b/kopete/protocols/oscar/oscarpresence.cpp @@ -0,0 +1,43 @@ +/* + oscarpresence.cpp - Oscar presence class + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include "oscarpresence.h" + +namespace Oscar +{ + +Presence::Presence( Type type, Flags flags ) +{ + mInternalStatus = type | flags; +} + +Presence::Presence( uint internalStatus ) +{ + mInternalStatus = internalStatus; +} + +void Presence::setType( Type type ) +{ + mInternalStatus = type | flags(); +} + +void Presence::setFlags( Flags flags ) +{ + mInternalStatus = type() | flags; +} + +} diff --git a/kopete/protocols/oscar/oscarpresence.h b/kopete/protocols/oscar/oscarpresence.h new file mode 100644 index 000000000..755a571b3 --- /dev/null +++ b/kopete/protocols/oscar/oscarpresence.h @@ -0,0 +1,84 @@ +/* + oscarpresence.h - Oscar presence class + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + + +#ifndef OSCARPRESENCE_H +#define OSCARPRESENCE_H + +#include +#include + +#include "kopete_export.h" + +class OscarStatusManager; + +namespace Oscar +{ + +/** + * @brief An Oscar presence object + */ +class OSCAR_EXPORT Presence +{ +public: + /** + * Friendly types this status can be + */ + enum Type { Offline = 0x000, DoNotDisturb = 0x001, Occupied = 0x002, + NotAvailable = 0x003, Away = 0x004, FreeForChat = 0x005, Online = 0x006 }; + enum { TypeCount = Online + 1 }; + + enum Flag { None = 0x000, AIM = 0x010, ICQ = 0x020, Wireless = 0x100, Invisible = 0x200, XStatus = 0x400 }; + Q_DECLARE_FLAGS(Flags, Flag) + + Presence( Type type, Flags flags = None ); + + void setType( Type type ); + Type type() const { return (Type)(mInternalStatus & 0x0000000F); } + + void setFlags( Flags flags ); + Flags flags() const { return (Flags)(mInternalStatus & 0xFFFFFFF0); } + + uint internalStatus() const { return mInternalStatus; } + + bool operator==( const Presence &other ) const { return other.mInternalStatus == mInternalStatus; } + bool operator!=( const Presence &other ) const { return !(*this == other); } + + /** + * XStatus functions. + */ + void setDescription( const QString& desc ) { mDescription = desc; } + QString description() const { return mDescription; } + + void setIcon( const QString& icon ) { mIcon = icon; } + QString icon() const { return mIcon; } + +private: + friend class ::OscarStatusManager; + Presence( uint internalStatus ); + + uint mInternalStatus; + + // For XStatus + QString mDescription; + QString mIcon; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(Presence::Flags) + +} + +#endif diff --git a/kopete/protocols/oscar/oscarpresencesdataclasses.cpp b/kopete/protocols/oscar/oscarpresencesdataclasses.cpp new file mode 100644 index 000000000..2917da3ed --- /dev/null +++ b/kopete/protocols/oscar/oscarpresencesdataclasses.cpp @@ -0,0 +1,64 @@ +/* + oscarpresencesdataclasses.cpp - Oscar data classes for oscar status manager + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include "oscarpresencesdataclasses.h" + +namespace Oscar +{ + +//BEGIN class PresenceOverlay + +PresenceOverlay::PresenceOverlay() +: mFlags( Presence::None ) +{ +} + +PresenceOverlay::PresenceOverlay( Presence::Flags flags, QString description, QStringList icons ) + : mFlags(flags), mDescription(description), mIcons(icons) +{ +} + +PresenceOverlay &PresenceOverlay::operator+=( const PresenceOverlay &other ) +{ + mFlags |= other.mFlags; + if ( mDescription.isEmpty() ) + mDescription = other.mDescription; + else if ( !other.mDescription.isEmpty() ) + mDescription += QString( ", " ) + other.mDescription; + + mIcons << other.mIcons; + return *this; +} + +//END class PresenceOverlay + +//BEGIN class PresenceType + +PresenceType::PresenceType( Presence::Type type, Kopete::OnlineStatus::StatusType onlineStatusType, unsigned long setFlag, + unsigned long getFlag, QString caption, QString name, QStringList overlayIcons, + Kopete::OnlineStatusManager::Categories categories, Kopete::OnlineStatusManager::Options options, + FlagsList overlayFlagsList ) +: mType(type), mOnlineStatusType(onlineStatusType), mSetFlag(setFlag), mGetFlag(getFlag), mCaption(caption), + mName(name), mOverlayIcons(overlayIcons), mCategories(categories), mOptions(options), mOverlayFlagsList(overlayFlagsList) +{ +} + +//END class PresenceType + + +} // end namespace Oscar + diff --git a/kopete/protocols/oscar/oscarpresencesdataclasses.h b/kopete/protocols/oscar/oscarpresencesdataclasses.h new file mode 100644 index 000000000..c43668e4e --- /dev/null +++ b/kopete/protocols/oscar/oscarpresencesdataclasses.h @@ -0,0 +1,138 @@ +/* + oscarpresencesdataclasses.h - Oscar data classes for oscar status manager + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + + +#ifndef OSCARSPRESENCEDATACLASSES_H +#define OSCARSPRESENCEDATACLASSES_H + +#include "oscarpresence.h" + +#include + +#include +#include "kopete_export.h" + +namespace Kopete { class OnlineStatus; } + +class OscarProtocol; + +namespace Oscar +{ + +/** + * @brief This namespace contains status flags used in OSCAR's on-the-wire format. + * + * The IS_XXX values are bits representing actual status flags. However, the flags + * are just that -- flags. Oscar statuses are represented by a combination of these + * flags rather than just one value. This seems to be for backwards compatibility + * reasons -- this way you can add a new status and existing clients should still + * work correctly. + * + * So, when changing status you need to specify not only what status it is, but + * also all other status flags that are appropriate. The SET_XXX flags do just that; + * SET_DND for instance sets the DND, Occupied and Away bits. + */ +namespace StatusCode +{ + enum + { + OFFLINE = 0xFFFFFFFF, + ONLINE = 0x00000000, + INVISIBLE = 0x00000100, + + IS_DND = 0x00000002, ///< Do Not Disturb + IS_OCC = 0x00000010, ///< Occupied + IS_NA = 0x00000004, ///< Not Available + IS_AWAY = 0x00000001, ///< Away + IS_FFC = 0x00000020, ///< Free For Chat + + SET_DND = 0x00000013, //== DND + Occupied + Away + SET_OCC = 0x00000011, //== Occupied + Away + SET_NA = 0x00000005, //== NA + Away + SET_AWAY = 0x00000001, + SET_FFC = 0x00000020, + + WEBAWARE = 0x00010000, + SHOWIP = 0x00020000 + }; +} // end namespace StatusCode + +namespace ClassCode +{ + enum + { + AWAY = 0x0020, + ICQ = 0x0040, + WIRELESS = 0x0080 + }; +} // end namespace ClassCode + +class OSCAR_EXPORT PresenceOverlay +{ +public: + PresenceOverlay(); + PresenceOverlay( Presence::Flags flags, QString name, QStringList icons ); + + Presence::Flags flags() const { return mFlags; } + QString description() const { return mDescription; } + QStringList icons() const { return mIcons; } + + PresenceOverlay &operator+= ( const PresenceOverlay &other ); + +private: + Presence::Flags mFlags; + QString mDescription; + QStringList mIcons; +}; + +class OSCAR_EXPORT PresenceType +{ +public: + typedef QList FlagsList; + PresenceType( Presence::Type type, Kopete::OnlineStatus::StatusType onlineStatusType, + unsigned long setFlag, unsigned long getFlag, QString caption, QString name, + QStringList overlayIcons, Kopete::OnlineStatusManager::Categories categories, + Kopete::OnlineStatusManager::Options options, FlagsList overlayFlagsList ); + + Presence::Type type() const { return mType; } + Kopete::OnlineStatus::StatusType onlineStatusType() const { return mOnlineStatusType; } + unsigned long setFlag() const { return mSetFlag; } + unsigned long getFlag() const { return mGetFlag; } + QString caption() const { return mCaption; } + QString name() const { return mName; } + QStringList overlayIcons() const { return mOverlayIcons; } + Kopete::OnlineStatusManager::Categories categories() const { return mCategories; } + Kopete::OnlineStatusManager::Options options() const { return mOptions; } + FlagsList overlayFlagsList() const { return mOverlayFlagsList; } + +private: + Presence::Type mType; + Kopete::OnlineStatus::StatusType mOnlineStatusType; + unsigned long mSetFlag; + unsigned long mGetFlag; + QString mCaption; + QString mName; + QStringList mOverlayIcons; + Kopete::OnlineStatusManager::Categories mCategories; + Kopete::OnlineStatusManager::Options mOptions; + FlagsList mOverlayFlagsList; +}; + +} + +#endif + diff --git a/kopete/protocols/oscar/oscarprotocol.h b/kopete/protocols/oscar/oscarprotocol.h index 95d56cc12..fd0387f45 100644 --- a/kopete/protocols/oscar/oscarprotocol.h +++ b/kopete/protocols/oscar/oscarprotocol.h @@ -24,6 +24,7 @@ #include "kopete_export.h" #include "kopetecontactproperty.h" +class OscarStatusManager; class OSCAR_EXPORT OscarProtocol : public Kopete::Protocol { @@ -42,6 +43,7 @@ public: const Kopete::ContactPropertyTmpl buddyIconHash; const Kopete::ContactPropertyTmpl contactEncoding; + virtual OscarStatusManager *statusManager() const = 0; }; #endif diff --git a/kopete/protocols/oscar/oscarstatusmanager.cpp b/kopete/protocols/oscar/oscarstatusmanager.cpp new file mode 100644 index 000000000..eb2ef5079 --- /dev/null +++ b/kopete/protocols/oscar/oscarstatusmanager.cpp @@ -0,0 +1,266 @@ +/* + oscarstatusmanager.cpp - Oscar status manager + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + + +#include "oscarstatusmanager.h" + +#include + +#include + +#include "oscarprotocol.h" +#include "oscarpresencesdataclasses.h" + +class OscarStatusManager::Private +{ +public: + OscarProtocol* protocol; + + typedef QHash StatusHash; + StatusHash statusHash; + + QList presenceTypeList; + QList presenceOverlayList; + + Oscar::Presence::Flags mask; +}; + +OscarStatusManager::OscarStatusManager( OscarProtocol* protocol ) + : d( new Private() ) +{ + d->protocol = protocol; + d->mask = ~(Oscar::Presence::Flags)Oscar::Presence::None; +} + +OscarStatusManager::~OscarStatusManager() +{ + delete d; +} + +void OscarStatusManager::initialize( uint firstUsableWeight ) +{ + for ( uint i = 0; i < Oscar::Presence::TypeCount; ++i ) + { + const Oscar::PresenceType &data = pscTypeForType( static_cast(i) ); + const uint weight = i + firstUsableWeight; + for ( int j = 0; j < data.overlayFlagsList().count(); ++j ) + { + const uint internalStatus = data.overlayFlagsList().at(j) | data.type(); + + Kopete::OnlineStatus status; + if ( data.overlayFlagsList().at(j) != Oscar::Presence::None ) + { + Oscar::PresenceOverlay overlay = pscOverlayForFlags( data.overlayFlagsList().at(j) ); + //don't add KOS to account's context menu + status = Kopete::OnlineStatus( data.onlineStatusType(), weight, + d->protocol, internalStatus, + data.overlayIcons() + overlay.icons(), + data.name() + QString(" (%1)").arg( overlay.description() ) ); + } + else + { + //add KOS + status = Kopete::OnlineStatus( data.onlineStatusType(), weight, + d->protocol, internalStatus, + data.overlayIcons(), data.name(), + data.caption(), data.categories(), data.options() ); + } + d->statusHash[internalStatus] = status; + } + } +} + +void OscarStatusManager::setPresenceType( const QList& list ) +{ + d->presenceTypeList = list; +} + +void OscarStatusManager::setPresenceOverlay( const QList& list ) +{ + d->presenceOverlayList = list; +} + +void OscarStatusManager::setPresenceFlagsMask( Oscar::Presence::Flags mask ) +{ + d->mask = mask; +} + +Kopete::OnlineStatus OscarStatusManager::onlineStatusOf( const Oscar::Presence &presence ) const +{ + uint internalStatus = presence.internalStatus() & d->mask; + if ( (internalStatus & Oscar::Presence::XStatus) == Oscar::Presence::XStatus ) + { + kDebug() << k_funcinfo << "Creating Kopete::OnlineStatus for XStatus, internal status: " << internalStatus << endl; + // XStatus, we have to create new KOS + Oscar::PresenceOverlay overlay = pscOverlayForFlags( (Oscar::Presence::Flags)(internalStatus & 0xFFFFFFF0) ); + + QString desc = presence.description(); + if ( !overlay.description().isEmpty() ) + desc += QString(" (%1)").arg( overlay.description() ); + + return Kopete::OnlineStatus( Kopete::OnlineStatus::Online, 0, d->protocol, internalStatus, + QStringList( presence.icon() ) + overlay.icons(), desc ); + } + else + { + if ( d->statusHash.contains( internalStatus ) ) + { + return d->statusHash.value( internalStatus ); + } + else if ( d->statusHash.contains( presence.type() ) ) + { + kWarning() << k_funcinfo << "Kopete::OnlineStatus doesn't exists for internal status " << internalStatus + << " Using basic status for type " << presence.type() << endl; + return d->statusHash.value( presence.type() ); + } + else + { + kWarning() << k_funcinfo << "Kopete::OnlineStatus doesn't exists for internal status " << internalStatus << endl; + return unknownStatus(); + } + } +} + +Oscar::Presence OscarStatusManager::presenceOf( const Kopete::OnlineStatus &status ) const +{ + if ( status.protocol() == d->protocol ) + { + Oscar::Presence presence( status.internalStatus() ); + if ( (presence.flags() & Oscar::Presence::XStatus) == Oscar::Presence::XStatus ) + { + // XStatus, we have to filter out overlayIcons and description + Oscar::PresenceOverlay overlay = pscOverlayForFlags( presence.flags() ); + + QString desc = status.description(); + if ( !overlay.description().isEmpty() ) + desc.remove( QString(" (%1)").arg( overlay.description() ) ); + + presence.setDescription( desc ); + + QStringList overlayIcons = status.overlayIcons(); + if ( !overlayIcons.isEmpty() ) + presence.setIcon( overlayIcons.at( 0 ) ); + } + return presence; + } + else + { + //status is a libkopete builtin status object + //don't even think about converting it to Oscar::Presence using presenceOf! + return Oscar::Presence( pscTypeForOnlineStatusType( status.status() ).type(), + Oscar::Presence::None ); + } +} + +unsigned long OscarStatusManager::oscarStatusOf( const Oscar::Presence &presence ) const +{ + unsigned long basicStatus = basicOscarStatus( presence.type() ); + if ( (presence.internalStatus() & Oscar::Presence::Invisible) == Oscar::Presence::Invisible ) + basicStatus |= Oscar::StatusCode::INVISIBLE; + return basicStatus; +} + +Oscar::Presence OscarStatusManager::presenceOf( unsigned long oStatus, int oClass ) const +{ + using namespace Oscar; + Presence::Type type = pscTypeForOscarStatus( oStatus ); + + //Hack for aim away contacts + if ( type == Presence::Online && (oClass & ClassCode::AWAY) == ClassCode::AWAY ) + type = Presence::Away; + + Presence::Flags flags = Presence::None; + if ( (oClass & ClassCode::ICQ) == ClassCode::ICQ ) + flags |= Presence::ICQ; + else + flags |= Presence::AIM; + + if ( (oClass & ClassCode::WIRELESS) == ClassCode::WIRELESS ) + flags |= Presence::Wireless; + + if ( (oStatus & StatusCode::INVISIBLE) == StatusCode::INVISIBLE ) + flags |= Presence::Invisible; + + return Presence( type, flags ); +} + +unsigned long OscarStatusManager::basicOscarStatus( Oscar::Presence::Type type ) const +{ + const Oscar::PresenceType &data = pscTypeForType( type ); + return data.setFlag(); +} + +Oscar::Presence::Type OscarStatusManager::pscTypeForOscarStatus( unsigned long status ) const +{ + const Oscar::PresenceType &data = pscTypeForStatus( status & 0xff ); + return data.type(); +} + +Oscar::PresenceOverlay OscarStatusManager::pscOverlayForFlags( Oscar::Presence::Flags flags ) const +{ + Oscar::PresenceOverlay overlay; + int size = d->presenceOverlayList.size(); + for ( int i = 0; i < size; i++ ) + { + Oscar::PresenceOverlay data = d->presenceOverlayList.at(i); + if ( data.flags() == flags ) + return data; + else if ( data.flags() & flags ) + overlay += data; + } + + return overlay; +} + +const Oscar::PresenceType &OscarStatusManager::pscTypeForType( Oscar::Presence::Type type ) const +{ + int size = d->presenceTypeList.size(); + for ( int n = 0; n < size; ++n ) + { + if ( d->presenceTypeList.at(n).type() == type ) + return d->presenceTypeList.at(n); + } + + kWarning(14153) << k_funcinfo << "type " << (int)type << " not found! Returning Offline" << endl; + return d->presenceTypeList.at(0); +} + +const Oscar::PresenceType &OscarStatusManager::pscTypeForStatus( unsigned long status ) const +{ + int size = d->presenceTypeList.size(); + for ( int n = 0; n < size; ++n ) + { + if ( (d->presenceTypeList.at(n).getFlag() & status) == d->presenceTypeList.at(n).getFlag() ) + return d->presenceTypeList.at(n); + } + + kWarning(14153) << k_funcinfo << "status " << (int)status << " not found! Returning Offline. This should not happen." << endl; + return d->presenceTypeList.at(0); +} + +const Oscar::PresenceType &OscarStatusManager::pscTypeForOnlineStatusType( const Kopete::OnlineStatus::StatusType statusType ) const +{ + int size = d->presenceTypeList.size(); + for ( int n = size - 1; n >= 0; --n ) + { + if ( d->presenceTypeList.at(n).onlineStatusType() == statusType ) + return d->presenceTypeList.at(n); + } + + kWarning(14153) << k_funcinfo << "online status " << (int)statusType << " not found! Returning Offline. This should not happen." << endl; + return d->presenceTypeList.at(0); +} diff --git a/kopete/protocols/oscar/oscarstatusmanager.h b/kopete/protocols/oscar/oscarstatusmanager.h new file mode 100644 index 000000000..506f9ba34 --- /dev/null +++ b/kopete/protocols/oscar/oscarstatusmanager.h @@ -0,0 +1,110 @@ +/* + oscarstatusmanager.h - Oscar status manager + + Copyright (c) 2004 by Richard Smith + Copyright (c) 2006,2007 by Roman Jarosz + Kopete (c) 2002-2007 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + + +#ifndef OSCARSTATUSMANAGER_H +#define OSCARSTATUSMANAGER_H + +#include "oscarpresence.h" +#include + +#include "kopete_export.h" + +namespace Kopete { class OnlineStatus; } + +namespace Oscar +{ + class PresenceType; + class PresenceOverlay; +} + +class OscarProtocol; + +/** + * @brief A manager for Oscar's online statuses + * + * Looks after Oscar's numerous online statuses, and maps between them and Presence objects. + * A single instance of this class is held by the AIMProtocol and ICQProtocol object. + */ +class OSCAR_EXPORT OscarStatusManager +{ +public: + OscarStatusManager( OscarProtocol* protocol ); + virtual ~OscarStatusManager(); + + /** + * Create KOS from PresenceType and PresenceOverlay lists. + */ + void initialize( uint firstUsableWeight ); + + /** + * Set PresenceType list. + */ + void setPresenceType( const QList& list ); + + /** + * Set available overlays. + * We can define overlay for one flag from Oscar::Presence::Flags or + * for combination of Oscar::Presence::Flags. + */ + void setPresenceOverlay( const QList& list ); + + /** + * Set Presence::Flags mask. This will filter unnecessary overlays. + * E.g. ICQ flag for ICQ account or contacts presence. + */ + void setPresenceFlagsMask( Oscar::Presence::Flags mask ); + + /** + * Generate an online status from a Presence object + */ + Kopete::OnlineStatus onlineStatusOf( const Oscar::Presence &presence ) const; + + /** + * Generate a Presence object from an online status + */ + Oscar::Presence presenceOf( const Kopete::OnlineStatus &status ) const; + + /** + * Get the status code to pass to liboscar to set us to this Status. + * @note This is not the opposite of onlineStatusOf(). + */ + unsigned long oscarStatusOf( const Oscar::Presence &presence ) const; + + /** + * Get the status a contact is at based on liboscar's view of its status. + */ + Oscar::Presence presenceOf( unsigned long oStatus, int oClass ) const; + + virtual Kopete::OnlineStatus connectingStatus() const = 0; + virtual Kopete::OnlineStatus unknownStatus() const = 0; + virtual Kopete::OnlineStatus waitingForAuth() const = 0; + +private: + unsigned long basicOscarStatus( Oscar::Presence::Type type ) const; + Oscar::Presence::Type pscTypeForOscarStatus( unsigned long status ) const; + Oscar::PresenceOverlay pscOverlayForFlags( Oscar::Presence::Flags flags ) const; + + const Oscar::PresenceType &pscTypeForType( Oscar::Presence::Type type ) const; + const Oscar::PresenceType &pscTypeForStatus( unsigned long status ) const; + const Oscar::PresenceType &pscTypeForOnlineStatusType( const Kopete::OnlineStatus::StatusType statusType ) const; + + class Private; + Private *d; +}; + +#endif -- 2.11.4.GIT