[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [Konversation] 3f32d6d: All the nicks in the addressbook are watched,
From: John Tapsell <john.tapsell () kdemail ! net>
Date: 2010-07-01 13:28:01
Message-ID: 20100701132801.78B64BB5744 () projects ! kde ! org
[Download RAW message or body]
commit 3f32d6d07fa131559852399937be2cf91212785a
Author: John Tapsell <john.tapsell@kdemail.net>
Date: Wed Aug 18 11:54:08 2004 +0000
All the nicks in the addressbook are watched, as well as the watched nick list.
I think I've done it so that everyone should be happy.
You can now do:
( DCOPKONQ=$(dcop | grep konversation | head -n 1); for f in $(dcop $DCOPKONQ \
KIMIface onlineContacts); do dcop $DCOPKONQ KIMIface displayName $f; done; ) for \
example.
Unfortunetly, in testing this, I've been klined from freenode :\
Someone unban me!
svn path=/trunk/kdeextragear-2/konversation/; revision=338817
diff --git a/konversation/linkaddressbook/addressbook.cpp \
b/konversation/linkaddressbook/addressbook.cpp index abf5e62..4eeceef 100644
--- a/konversation/linkaddressbook/addressbook.cpp
+++ b/konversation/linkaddressbook/addressbook.cpp
@@ -63,6 +63,8 @@ bool Addressbook::hasNick(const KABC::Addressee &addressee, const \
QString &ircni return false;
}
+
+
QString Addressbook::getMainNick(const KABC::Addressee &addressee) {
//Get the first nick
//TODO: Strip off server part
@@ -275,6 +277,13 @@ QStringList Addressbook::allContacts() {
if(hasAnyNicks(*it,"")) contactUIDS.append((*it).uid());
return contactUIDS;
}
+//Produces a string list of all the irc nicks that are known.
+QStringList Addressbook::allContactsNicks() {
+ QStringList contacts;
+ for( KABC::AddressBook::Iterator it = addressBook->begin(); it != \
addressBook->end(); ++it ) + contacts += QStringList::split( QChar( 0xE000 ), \
(*it).custom("messaging/irc", "All") ); + return contacts;
+}
bool Addressbook::isOnline(KABC::Addressee &addressee) {
QStringList addresses = QStringList::split( QChar( 0xE000 ), \
addressee.custom("messaging/irc", "All") ); @@ -310,6 +319,10 @@ QString \
Addressbook::displayName(const QString &uid) { return \
getMainNick(addressBook->findByUid(uid)); }
QString Addressbook::presenceString(const QString &uid) {
+ if(uid.isEmpty()) {
+ kdDebug() << "Addressbook::presenceString() called with an empty uid" << endl;
+ return QString("Error");
+ }
switch( presenceStatus(uid)) {
case 0:
return i18n("On different servers to us");
diff --git a/konversation/linkaddressbook/addressbook.h \
b/konversation/linkaddressbook/addressbook.h index 65cf3b7..519f2e1 100644
--- a/konversation/linkaddressbook/addressbook.h
+++ b/konversation/linkaddressbook/addressbook.h
@@ -50,6 +50,7 @@ class Addressbook : public QObject,public KIMIface
KABC::AddressBook *getAddressBook();
static Addressbook *self();
+ QStringList allContactsNicks();
QStringList allContacts();
QStringList reachableContacts();
QStringList onlineContacts();
diff --git a/konversation/outputfilter.cpp b/konversation/outputfilter.cpp
index b899622..7119e5d 100644
--- a/konversation/outputfilter.cpp
+++ b/konversation/outputfilter.cpp
@@ -734,7 +734,7 @@ namespace Konversation {
}
// show (new) notify list to user
- QString list = KonversationApplication::preferences.getNotifyString();
+ QString list = KonversationApplication::preferences.getNotifyString() + " " \
+ Konversation::Addressbook::self()->allContacts().join(" "); result.typeString = \
i18n("Notify");
if(list.isEmpty())
diff --git a/konversation/server.cpp b/konversation/server.cpp
index 59b59d3..0247a24 100644
--- a/konversation/server.cpp
+++ b/konversation/server.cpp
@@ -696,9 +696,9 @@ void Server::notifyResponse(const QString& nicksOnline)
// Create a lower case nick list from the notification reply
QStringList nickLowerList=QStringList::split(' ',nicksOnline.lower());
// Get watch list from preferences.
- QString watchlist=KonversationApplication::preferences.getNotifyString();
+ QString watchlist=getNotifyString();
// Create a case correct nick list from the watch list.
- QStringList watchList=QStringList::split(' ',watchlist);
+ QStringList watchList=QStringList::split(' ',watchlist);
// Create a lower case nick list from the watch list.
QStringList watchLowerList=QStringList::split(' ',watchlist.lower());
// Any new watched nicks online?
@@ -820,7 +820,7 @@ void Server::notifyTimeout()
if(KonversationApplication::preferences.getUseNotify())
{
// But only if there actually are nicks in the notify list
- QString list=KonversationApplication::preferences.getNotifyString();
+ QString list=getNotifyString();
if(!list.isEmpty())
{
queue("ISON "+list);
@@ -1160,7 +1160,7 @@ ChannelNickPtr Server::setChannelNick(const QString& \
channelName, const QString& if (!channelNick)
{
// Get watch list from preferences.
- QString watchlist=KonversationApplication::preferences.getNotifyString();
+ QString watchlist=getNotifyString();
// Create a lower case nick list from the watch list.
QStringList watchLowerList=QStringList::split(' ',watchlist.lower());
// If on the watch list, add channel and nick to unjoinedChannels list.
@@ -2098,13 +2098,17 @@ void Server::removeChannelNick(const QString& channelName, \
const QString& nickna void Server::removeChannelNick(const QString&, const QString&) \
{ } #endif
+QString Server::getNotifyString() {
+ return KonversationApplication::preferences.getNotifyString() +" " + \
Konversation::Addressbook::self()->allContactsNicks().join(" "); +}
+
// Remove channel from the joined list.
// Nicknames in the channel are added to the unjoined list if they are in the watch \
list. #ifdef USE_NICKINFO
void Server::removeJoinedChannel(const QString& channelName)
{
bool doSignal = false;
- QString watchList = KonversationApplication::preferences.getNotifyString();
+ QString watchList = getNotifyString();
QStringList watchListLower = QStringList::split(' ', watchList.lower());
QString lcChannelName = channelName.lower();
// Move the channel nick list from the joined to unjoined lists.
@@ -2359,7 +2363,7 @@ void Server::removeNickFromServer(const QString &nickname,const \
QString &reason)
#ifdef USE_NICKINFO
// Unless nick is in the watch list, delete it altogether, otherwise move it to \
nicknamesOffline list.
- QString watchList = KonversationApplication::preferences.getNotifyString();
+ QString watchList = getNotifyString();
QStringList watchListLower = QStringList::split(' ', watchList.lower());
addNickToOfflineList(nickname, watchListLower);
#endif
diff --git a/konversation/server.h b/konversation/server.h
index 04a3682..7a5f640 100644
--- a/konversation/server.h
+++ b/konversation/server.h
@@ -179,7 +179,7 @@ class Server : public QObject
void emitChannelNickChanged(const ChannelNickPtr channelNick);
void emitNickInfoChanged(const NickInfoPtr nickInfo);
-
+ QString Server::getNotifyString();
signals:
void nicknameChanged(const QString&);
void serverLag(Server* server,int msec); // will be connected to \
KonversationMainWindow::updateLag()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic