Updated patch here.

On Wednesday 15 February 2006 05:31, Matt Rogers wrote:
> On Tuesday 14 February 2006 23:21, Brian Smith wrote:
>> [snip]
>
> I like the new const WORD definitions, but I'm not sure about the logic
> behind the change. It is possible for somebody to be a wireless user and
> away at the same time, so I guess we'd need some sort of overlay type thing
> unless we just want to treat moblie users differently.
>
We don't, they should be a first class 'citizen' of the IM world.
The new patch nicely does the overlays [with the phone overlay icon], with new 
statuses for both the 'online mobile' status and the 'away mobile' status.

Note: we also make use of the nice const WORDs now.

Index: protocols/oscar/aim/aimcontact.cpp
===================================================================
--- protocols/oscar/aim/aimcontact.cpp  (revision 509857)
+++ protocols/oscar/aim/aimcontact.cpp  (working copy)
@@ -54,6 +54,7 @@
        m_warnUserAction = 0L;
        mUserProfile="";
        m_haveAwayMessage = false;
+       m_mobile = false;
        // Set the last autoresponse time to the current time yesterday
        m_lastAutoresponseTime = QDateTime::currentDateTime().addDays(-1);
 
@@ -186,14 +187,44 @@
        if ( nickname.isEmpty() || Oscar::normalize( nickname ) == 
Oscar::normalize( contact ) )
                setNickName( contact );
 
-       if ( ( details.userClass() & 32 ) == 0 )
+       ( details.userClass() & CLASS_WIRELESS ) ? m_mobile = true : m_mobile = 
false;
+
+       if ( ( details.userClass() & CLASS_AWAY ) == STATUS_ONLINE )
        {
-               setOnlineStatus( mProtocol->statusOnline ); //we're online
+               if ( m_mobile ) 
+               {
+                       kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " 
<< contact << " is mobile-online." << endl;
+                       setOnlineStatus( mProtocol->statusWirelessOnline );
+       }
+               else 
+               {
+                       kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " 
<< contact << " is online." << endl;
+                       setOnlineStatus( mProtocol->statusOnline ); //we're 
online
+               }
                removeProperty( mProtocol->awayMessage );
                m_haveAwayMessage = false;
        }
+       else if ( ( details.userClass() & CLASS_AWAY ) ) // STATUS_AWAY
+       {
+               if ( m_mobile ) 
+               {
+                       kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " 
<< contact << " is mobile-away." << endl;
+                       setOnlineStatus( mProtocol->statusWirelessOnline );
+               }
+               else 
+               {
+                       kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " 
<< contact << " is away." << endl;
+                       setOnlineStatus( mProtocol->statusAway ); //we're away
+               }
+               if ( !m_haveAwayMessage ) //prevent cyclic away message requests
+               {
+                       mAccount->engine()->requestAIMAwayMessage( contactId() 
);
+                       m_haveAwayMessage = true;
+               }
+       }
        else
        {
+        kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Contact: " << contact << " 
class " << details.userClass() << " is unhandled... defaulting to away." << 
endl;
                setOnlineStatus( mProtocol->statusAway ); //we're away
                if ( !m_haveAwayMessage ) //prevent cyclic away message requests
                {
@@ -242,14 +273,20 @@
                if ( message.isEmpty() )
                {
                        removeProperty( mProtocol->awayMessage );
-                       setOnlineStatus( mProtocol->statusOnline );
+                       if ( !m_mobile )
+                               setOnlineStatus( mProtocol->statusOnline );
+                       else
+                               setOnlineStatus( 
mProtocol->statusWirelessOnline );
                        m_haveAwayMessage = false;
                }
                else
                {
                        m_haveAwayMessage = true;
                        setAwayMessage( message );
-                       setOnlineStatus( mProtocol->statusAway );
+                       if ( !m_mobile )
+                               setOnlineStatus( mProtocol->statusAway );
+                       else
+                               setOnlineStatus( mProtocol->statusWirelessAway 
);
                }
        }
 
Index: protocols/oscar/aim/aimcontact.h
===================================================================
--- protocols/oscar/aim/aimcontact.h    (revision 509857)
+++ protocols/oscar/aim/aimcontact.h    (working copy)
@@ -91,6 +91,7 @@
        AIMUserInfoDialog* m_infoDialog;
        QString mUserProfile;
        bool m_haveAwayMessage;
+       bool m_mobile; // Is this user mobile (i.e. do they have message 
forwarding on, or mobile AIM)
        QDateTime m_lastAutoresponseTime;
        
        KAction* m_warnUserAction;
Index: protocols/oscar/aim/aimprotocol.cpp
===================================================================
--- protocols/oscar/aim/aimprotocol.cpp (revision 509857)
+++ protocols/oscar/aim/aimprotocol.cpp (working copy)
@@ -15,7 +15,7 @@
   *************************************************************************
   */
 
-
+#include <qstringlist.h>
 #include <kgenericfactory.h>
 #include <kdebug.h>
 
@@ -220,10 +220,14 @@
 
 AIMProtocol::AIMProtocol(QObject *parent, const char *name, const QStringList 
&)
   : Kopete::Protocol( AIMProtocolFactory::instance(), parent, name ),
-       statusOnline( Kopete::OnlineStatus::Online, 1, this, 0, QString::null, 
i18n("Online"), i18n("Online"), Kopete::OnlineStatusManager::Online ),
-       statusOffline( Kopete::OnlineStatus::Offline, 1, this, 10, 
QString::null, i18n("Offline"), i18n("Offline"), 
Kopete::OnlineStatusManager::Offline ),
-       statusAway( Kopete::OnlineStatus::Away, 1, this, 20, 
"contact_away_overlay", i18n("Away"), i18n("Away"), 
Kopete::OnlineStatusManager::Away,
+       statusOnline( Kopete::OnlineStatus::Online, 2, this, 0, QString::null, 
i18n("Online"), i18n("Online"), Kopete::OnlineStatusManager::Online ),
+       statusOffline( Kopete::OnlineStatus::Offline, 2, this, 10, 
QString::null, i18n("Offline"), i18n("Offline"), 
Kopete::OnlineStatusManager::Offline ),
+       statusAway( Kopete::OnlineStatus::Away, 2, this, 20, 
"contact_away_overlay", i18n("Away"), i18n("Away"), 
Kopete::OnlineStatusManager::Away,
                                                        
Kopete::OnlineStatusManager::HasAwayMessage ),
+       statusWirelessOnline( Kopete::OnlineStatus::Online, 1, this, 30, 
"contact_phone_overlay", i18n("Mobile"), i18n("Mobile"),
+       Kopete::OnlineStatusManager::Online, 
Kopete::OnlineStatusManager::HideFromMenu ),
+       statusWirelessAway( Kopete::OnlineStatus::Away, 1, this, 31, 
QStringList::split( " ", "contact_phone_overlay contact_away_overlay"),
+       i18n("Mobile Away"), i18n("Mobile Away"), 
Kopete::OnlineStatusManager::Away, Kopete::OnlineStatusManager::HideFromMenu ),
        statusConnecting(Kopete::OnlineStatus::Connecting, 99, this, 99, 
"aim_connecting", i18n("Connecting...")),
        awayMessage(Kopete::Global::Properties::self()->awayMessage()),
        clientFeatures("clientFeatures", i18n("Client Features"), 0, false),
Index: protocols/oscar/aim/aimprotocol.h
===================================================================
--- protocols/oscar/aim/aimprotocol.h   (revision 509857)
+++ protocols/oscar/aim/aimprotocol.h   (working copy)
@@ -66,6 +66,8 @@
        const Kopete::OnlineStatus statusOnline;
        const Kopete::OnlineStatus statusOffline;
        const Kopete::OnlineStatus statusAway;
+       const Kopete::OnlineStatus statusWirelessOnline;
+       const Kopete::OnlineStatus statusWirelessAway;
        const Kopete::OnlineStatus statusConnecting;
 
        const Kopete::ContactPropertyTmpl awayMessage;
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to