[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kopete/protocols/wlm
From: Tiago Salem Herrmann <tiagosh () gmail ! com>
Date: 2008-12-01 2:43:51
Message-ID: 1228099431.901579.13152.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 891059 by salem:
- add wlm_blocked to overlayIcons on blocked contacts
- prompt to add users on pending list
- change some Kopete::Contact by WlmContact
M +26 -7 wlmaccount.cpp
M +10 -0 wlmaccount.h
M +1 -1 wlmchatmanager.cpp
M +5 -5 wlmchatsession.cpp
M +1 -1 wlmchatsession.h
M +60 -1 wlmcontact.cpp
M +2 -0 wlmcontact.h
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/wlmaccount.cpp #891058:891059
@@ -264,7 +264,7 @@
actions |= Kopete::AddedInfoEvent::BlockAction;
//actions |= Kopete::AddedInfoEvent::InfoAction;
- Kopete::Contact * ct = contacts().value(passport);
+ WlmContact * ct = dynamic_cast<WlmContact*>(contacts().value(passport));
if (!ct || !ct->metaContact() || ct->metaContact()->isTemporary())
actions |= Kopete::AddedInfoEvent::AddAction;
@@ -277,12 +277,18 @@
kDebug() << "contact " << passport << " added to block list";
m_allowList.remove(passport);
m_blockList.insert(passport);
+ WlmContact * ct = dynamic_cast<WlmContact*>(contacts().value(passport));
+ if(ct)
+ ct->setOnlineStatus(ct->onlineStatus());
}
else if (list == MSN::LST_AL)
{
kDebug() << "contact " << passport << " added to allow list";
m_blockList.remove(passport);
m_allowList.insert(passport);
+ WlmContact * ct = dynamic_cast<WlmContact*>(contacts().value(passport));
+ if(ct)
+ ct->setOnlineStatus(ct->onlineStatus());
}
}
@@ -341,7 +347,7 @@
const QString & filename)
{
kDebug (14210) << k_funcinfo;
- Kopete::Contact * contact = contacts ()[contactId];
+ WlmContact * contact = dynamic_cast<WlmContact*>(contacts ()[contactId]);
if (contact)
{
if (!QFile (filename).exists () || !QFile (filename).size ())
@@ -392,7 +398,7 @@
const MSN::personalInfo & pInfo)
{
kDebug (14210) << k_funcinfo;
- Kopete::Contact * contact = contacts ()[fromPassport.c_str ()];
+ WlmContact * contact = dynamic_cast<WlmContact*>(contacts ()[fromPassport.c_str \
()]); if (contact)
{
// TODO - handle the other fields of pInfo
@@ -428,7 +434,7 @@
Q_UNUSED( clientID );
kDebug (14210) << k_funcinfo;
- Kopete::Contact * contact = contacts ()[buddy.c_str ()];
+ WlmContact *contact = dynamic_cast<WlmContact*>(contacts ()[buddy.c_str ()]);
if (contact)
{
contact->setProperty (Kopete::Global::Properties::self ()->
@@ -511,7 +517,7 @@
WlmAccount::contactDisconnected (const MSN::Passport & buddy)
{
kDebug (14210) << k_funcinfo;
- Kopete::Contact * contact = contacts ()[buddy.c_str ()];
+ WlmContact * contact = dynamic_cast<WlmContact*>(contacts ()[buddy.c_str ()]);
if (contact)
{
contact->setOnlineStatus (WlmProtocol::protocol ()->wlmOffline);
@@ -587,6 +593,8 @@
m_allowList.insert( passport );
if ( b->lists & MSN::LST_BL )
m_blockList.insert( passport );
+ if ( b->lists & MSN::LST_PL )
+ m_pendingList.insert( passport );
if ( !contacts().value( passport ) )
{
@@ -605,7 +613,7 @@
{
metacontact = addContact (b->userName.c_str (), QString(), 0L, \
Kopete::Account::DontChangeKABC);
- Kopete::Contact * newcontact = contacts ()[b->userName.c_str \
()]; + WlmContact * newcontact = \
dynamic_cast<WlmContact*>(contacts ()[b->userName.c_str ()]); if(!newcontact)
return;
@@ -844,6 +852,17 @@
// when is just connected.
QTimer::singleShot (10 * 1000, this, SLOT (disableInitialList ()));
setPersonalMessage(myself()->statusMessage());
+
+ // manage pending list
+ foreach ( QString contact, pendingList() )
+ {
+ // if we do not have this contact yet, so ask for add it
+ if(!isOnServerSideList(contact))
+ {
+ // fake this contact in RL to prompt the user to add it
+ gotNewContact (MSN::LST_RL, contact, contact);
+ }
+ }
}
void WlmAccount::gotAddedGroup (bool added,
@@ -1129,7 +1148,7 @@
{
kDebug (14210) << k_funcinfo;
QString contactId = m_oimList[id];
- Kopete::Contact * contact = contacts ()[contactId];
+ WlmContact * contact = dynamic_cast<WlmContact*>(contacts ()[contactId]);
Kopete::Message msg = Kopete::Message (contact, myself ());
msg.setPlainBody (message);
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/wlmaccount.h #891058:891059
@@ -114,9 +114,16 @@
bool isOnBlockList(const QString& passport) const { return m_blockList.contains( \
passport ); }
+ bool isOnPendingList(const QString& passport) const { return \
m_pendingList.contains( passport ); } +
+ // forward list (or also called address book)
+ bool isOnServerSideList(const QString& passport) const { return \
m_serverSideContactsPassports.contains( passport ); } +
QSet<QString> allowList() const { return m_allowList; }
QSet<QString> blockList() const { return m_blockList; }
+
+ QSet<QString> pendingList() const { return m_pendingList; }
QSet<QString> serverSideContacts() const { return m_serverSideContactsPassports; \
}
@@ -308,6 +315,9 @@
// passport set of contacts which are on block list
QSet<QString> m_blockList;
+ // passport set of contacts which are on pending list
+ QSet<QString> m_pendingList;
+
};
#endif
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/wlmchatmanager.cpp #891058:891059
@@ -209,7 +209,7 @@
if (chat)
{
- Kopete::Contact * contact = account ()->contacts ()[passport];
+ WlmContact * contact = dynamic_cast<WlmContact*>(account ()->contacts \
()[passport]); if (!contact)
return;
chat->removeContact (contact);
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/wlmchatsession.cpp #891058:891059
@@ -127,7 +127,7 @@
requestChatService ();
return;
}
- Kopete::Contact * c = account ()->contacts ()[passport];
+ WlmContact * c = dynamic_cast<WlmContact*>(account ()->contacts ()[passport]);
if (c)
slotInviteContact (c);
}
@@ -226,7 +226,7 @@
}
void
-WlmChatSession::slotInviteContact (Kopete::Contact * contact)
+WlmChatSession::slotInviteContact (WlmContact * contact)
{
// if we have a session, just invite the new contact
if (isReady ())
@@ -405,7 +405,7 @@
for (it = m_pendingInvitations.begin ();
it != m_pendingInvitations.end (); ++it)
{
- Kopete::Contact * c = account ()->contacts ()[(*it)];
+ WlmContact * c = dynamic_cast<WlmContact*>(account ()->contacts \
()[(*it)]); if (c)
slotInviteContact (c);
}
@@ -673,9 +673,9 @@
void
WlmChatSession::receivedNudge (QString passport)
{
- Kopete::Contact * c = account ()->contacts ()[passport];
+ WlmContact * c = dynamic_cast<WlmContact*>(account ()->contacts ()[passport]);
if (!c)
- c = members ().first ();
+ c = dynamic_cast<WlmContact*>(members ().first ());
Kopete::Message msg = Kopete::Message (c, myself ());
msg.setPlainBody (i18n ("has sent you a nudge"));
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/wlmchatsession.h #891058:891059
@@ -82,7 +82,7 @@
void sendNudge ();
void switchboardConnectionTimeout ();
void slotActionInviteAboutToShow ();
- void slotInviteContact (Kopete::Contact * contact);
+ void slotInviteContact (WlmContact * contact);
void slotSendFile ();
void sendKeepAlive ();
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/wlmcontact.cpp #891058:891059
@@ -48,7 +48,7 @@
setOnlineStatus (WlmProtocol::protocol ()->wlmOffline);
m_contactSerial = contactSerial;
- m_actionBlockContact = new KToggleAction(i18n("Block Contact"), this );
+ m_actionBlockContact = new KToggleAction(KIcon("wlm_blocked"), i18n("Block \
Contact"), this );
QObject::connect( m_actionBlockContact, SIGNAL(triggered(bool)), this, \
SLOT(blockContact(bool)) ); }
@@ -199,6 +199,65 @@
m_msgManager = 0L;
}
+void
+WlmContact::setOnlineStatus(const Kopete::OnlineStatus& status)
+{
+ bool isBlocked = dynamic_cast <WlmAccount \
*>(account())->isOnBlockList(contactId()); +
+ // if this contact is blocked, and currently has a regular status,
+ // create a custom status and add wlm_blocked to ovelayIcons
+ if(isBlocked && status.internalStatus() < 15)
+ {
+ Kopete::Contact::setOnlineStatus(
+ Kopete::OnlineStatus(status.status() ,
+ (status.weight()==0) ? 0 : (status.weight() -1),
+ protocol(),
+ status.internalStatus()+15,
+ status.overlayIcons() + QStringList("wlm_blocked"),
+ i18n("%1|Blocked", status.description() ) ) );
+ }
+ else if (!isBlocked && status.internalStatus() >= 15)
+ {
+ // if this contact was previously blocked, set a regular status again
+ switch(status.internalStatus()-15)
+ {
+ case 1:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmOnline);
+ break;
+ case 2:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmAway);
+ break;
+ case 3:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmBusy);
+ break;
+ case 4:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmBeRightBack);
+ break;
+ case 5:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmOnThePhone);
+ break;
+ case 6:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmOutToLunch);
+ break;
+ case 7:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmInvisible);
+ break;
+ case 8:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmOffline);
+ break;
+ case 9:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmIdle);
+ break;
+ default:
+ Kopete::Contact::setOnlineStatus(WlmProtocol::protocol()->wlmUnknown);
+ break;
+ }
+
+ }
+ else
+ Kopete::Contact::setOnlineStatus(status);
+}
+
#include "wlmcontact.moc"
// vim: set noet ts=4 sts=4 sw=4:
--- trunk/KDE/kdenetwork/kopete/protocols/wlm/wlmcontact.h #891058:891059
@@ -78,6 +78,8 @@
QString contactSerial () const { return m_contactSerial; }
+ void setOnlineStatus(const Kopete::OnlineStatus&);
+
public slots:
/**
* Transmits an outgoing message to the server
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic