summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/history/historyplugin.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/plugins/history/historyplugin.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/plugins/history/historyplugin.h')
-rw-r--r--kopete/plugins/history/historyplugin.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/kopete/plugins/history/historyplugin.h b/kopete/plugins/history/historyplugin.h
new file mode 100644
index 00000000..63e2c87b
--- /dev/null
+++ b/kopete/plugins/history/historyplugin.h
@@ -0,0 +1,106 @@
+/*
+ historyplugin.h
+
+ Copyright (c) 2003-2005 by Olivier Goffart <ogoffart at kde.org>
+ (c) 2003 by Stefan Gehn <metz AT gehn.net>
+ Kopete (c) 2003-2004 by the Kopete developers <kopete-devel@kde.org>
+
+ *************************************************************************
+ * *
+ * 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 HISTORYPLUGIN_H
+#define HISTORYPLUGIN_H
+
+#include <qobject.h>
+#include <qmap.h>
+#include <qstring.h>
+
+#include "kopeteplugin.h"
+
+#include "kopetemessage.h"
+#include "kopetemessagehandler.h"
+
+class KopeteView;
+class KActionCollection;
+
+namespace Kopete
+{
+class MetaContact;
+class ChatSession;
+}
+
+class HistoryPreferences;
+class HistoryGUIClient;
+class HistoryPlugin;
+
+/**
+ * @author Richard Smith
+ */
+class HistoryMessageLogger : public Kopete::MessageHandler
+{
+ HistoryPlugin *history;
+public:
+ HistoryMessageLogger( HistoryPlugin *history ) : history(history) {}
+ void handleMessage( Kopete::MessageEvent *event );
+};
+
+class HistoryMessageLoggerFactory : public Kopete::MessageHandlerFactory
+{
+ HistoryPlugin *history;
+public:
+ HistoryMessageLoggerFactory( HistoryPlugin *history ) : history(history) {}
+ Kopete::MessageHandler *create( Kopete::ChatSession * /*manager*/, Kopete::Message::MessageDirection direction )
+ {
+ if( direction != Kopete::Message::Inbound )
+ return 0;
+ return new HistoryMessageLogger(history);
+ }
+ int filterPosition( Kopete::ChatSession *, Kopete::Message::MessageDirection )
+ {
+ return Kopete::MessageHandlerFactory::InStageToSent+5;
+ }
+};
+
+/**
+ * @author Olivier Goffart
+ */
+class HistoryPlugin : public Kopete::Plugin
+{
+ Q_OBJECT
+ public:
+ HistoryPlugin( QObject *parent, const char *name, const QStringList &args );
+ ~HistoryPlugin();
+
+ /**
+ * convert the Kopete 0.6 / 0.5 history to the new format
+ */
+ static void convertOldHistory();
+ /**
+ * return true if an old history has been detected, and no new ones
+ */
+ static bool detectOldHistory();
+
+ void messageDisplayed(const Kopete::Message &msg);
+
+ private slots:
+ void slotViewCreated( KopeteView* );
+ void slotViewHistory();
+ void slotKMMClosed( Kopete::ChatSession* );
+ void slotSettingsChanged();
+
+ private:
+ HistoryMessageLoggerFactory m_loggerFactory;
+ QMap<Kopete::ChatSession*,HistoryGUIClient*> m_loggers;
+ Kopete::Message m_lastmessage;
+};
+
+#endif
+
+