summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/irc/irccontactmanager.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/protocols/irc/irccontactmanager.h
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/irc/irccontactmanager.h')
-rw-r--r--kopete/protocols/irc/irccontactmanager.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/kopete/protocols/irc/irccontactmanager.h b/kopete/protocols/irc/irccontactmanager.h
new file mode 100644
index 00000000..4a8ae05f
--- /dev/null
+++ b/kopete/protocols/irc/irccontactmanager.h
@@ -0,0 +1,117 @@
+/*
+ irccontactmanager.h - Manager of IRC Contacts
+
+ Copyright (c) 2003 by Michel Hermier <[email protected]>
+
+ Kopete (c) 2003 by the Kopete developers <[email protected]>
+
+ *************************************************************************
+ * *
+ * 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 IRCCONTACTMANAGER_H
+#define IRCCONTACTMANAGER_H
+
+#include <qdict.h>
+#include <qobject.h>
+#include <qstring.h>
+#include <qstringlist.h>
+
+class IRCContact;
+class IRCAccount;
+
+class IRCServerContact;
+class IRCChannelContact;
+class IRCUserContact;
+
+namespace KIRC
+{
+class Engine;
+}
+
+namespace Kopete
+{
+class Contact;
+class MetaContact;
+}
+
+class KopeteView;
+
+class QTimer;
+
+/**
+ * @author Michel Hermier <[email protected]>
+ *
+ * This class is the repository for all the reference of the @ref IRCContact childs.
+ * It manage the life cycle of all the @ref IRCServerContact, @ref IRCChannelContact and @ref IRCUserContact objects for the given account.
+ */
+class IRCContactManager
+ : public QObject
+{
+ Q_OBJECT
+
+ public:
+ IRCContactManager(const QString &nickName, IRCAccount *account, const char *name=0);
+
+ IRCAccount *account() const { return m_account; }
+
+ IRCServerContact *myServer() const { return m_myServer; }
+ IRCUserContact *mySelf() const { return m_mySelf; }
+
+ IRCChannelContact *findChannel(const QString &channel, Kopete::MetaContact *m=0);
+ IRCChannelContact *existChannel(const QString &channel) const;
+
+ IRCUserContact *findUser(const QString &nick, Kopete::MetaContact *m=0);
+ IRCUserContact *existUser(const QString &nick) const;
+
+ IRCContact *findContact(const QString &nick, Kopete::MetaContact *m=0);
+ IRCContact *existContact( const QString &id ) const;
+
+ QValueList<IRCChannelContact*> findChannelsByMember( IRCUserContact *contact );
+
+ static IRCContact *existContact(const KIRC::Engine *engine, const QString &nick);
+
+ public slots:
+ void unregister(Kopete::Contact *contact);
+ void unregisterUser(Kopete::Contact *contact, bool force = false );
+ void unregisterChannel(Kopete::Contact *contact, bool force = false );
+
+ void addToNotifyList(const QString &nick);
+ void removeFromNotifyList(const QString &nick);
+ void checkOnlineNotifyList();
+
+ signals:
+ void privateMessage(IRCContact *from, IRCContact *to, const QString &message);
+
+ private slots:
+ void slotNewMessage(const QString &originating, const QString &channel, const QString &message);
+ void slotNewPrivMessage(const QString &originating, const QString &, const QString &message);
+ void slotIsonRecieved();
+ void slotIsonTimeout();
+ void slotNewNickChange(const QString &oldnick, const QString &newnick);
+ void slotContactAdded( Kopete::MetaContact *contact );
+
+ private:
+ QDict<IRCChannelContact> m_channels;
+ QDict<IRCUserContact> m_users;
+
+ IRCAccount *m_account;
+ IRCServerContact *m_myServer;
+ IRCUserContact *m_mySelf;
+
+ QStringList m_NotifyList;
+ QTimer *m_NotifyTimer;
+ bool isonRecieved;
+ int socketTimeout;
+
+ static const QRegExp isChannel;
+};
+
+#endif
+