summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/kopetemessageevent.cpp
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/libkopete/kopetemessageevent.cpp
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/libkopete/kopetemessageevent.cpp')
-rw-r--r--kopete/libkopete/kopetemessageevent.cpp105
1 files changed, 105 insertions, 0 deletions
diff --git a/kopete/libkopete/kopetemessageevent.cpp b/kopete/libkopete/kopetemessageevent.cpp
new file mode 100644
index 00000000..fb129837
--- /dev/null
+++ b/kopete/libkopete/kopetemessageevent.cpp
@@ -0,0 +1,105 @@
+/*
+ kopetemessageevent.cpp - Kopete Message Event
+
+ Copyright (c) 2003 by Olivier Goffart <ogoffart @ kde.org>
+ Copyright (c) 2002 by Duncan Mac-Vicar Prett <duncan@kde.org>
+ Copyright (c) 2002 by Hendrik vom Lehn <hvl@linux-4-ever.de>
+ Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org>
+ Copyright (c) 2004 by Richard Smith <richard@metafoo.co.uk>
+
+ Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
+
+ *************************************************************************
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ *************************************************************************
+*/
+
+#include <kdebug.h>
+
+#include "kopetemessageevent.h"
+#include "kopetemetacontact.h"
+#include "kopetecontactlist.h"
+#include "kopetecontact.h"
+#include "kopeteprefs.h"
+
+namespace Kopete
+{
+
+class MessageEvent::Private
+{
+public:
+ Kopete::Message message;
+ EventState state;
+};
+
+MessageEvent::MessageEvent( const Message& m, QObject *parent, const char *name )
+ : QObject(parent,name), d( new Private )
+{
+ d->message = m;
+ d->state = Nothing;
+ const Contact *c=m.from();
+ if(c)
+ connect(c,SIGNAL(contactDestroyed( Kopete::Contact* )),this,SLOT(discard()));
+}
+
+MessageEvent::~MessageEvent()
+{
+ kdDebug(14010) << k_funcinfo << endl;
+ emit done(this);
+ delete d;
+}
+
+Kopete::Message MessageEvent::message()
+{
+ return d->message;
+}
+
+void MessageEvent::setMessage( const Kopete::Message &message )
+{
+ d->message = message;
+}
+
+MessageEvent::EventState MessageEvent::state()
+{
+ return d->state;
+}
+
+void MessageEvent::apply()
+{
+ kdDebug(14010) << k_funcinfo << endl;
+ d->state = Applied;
+ deleteLater();
+}
+
+void MessageEvent::ignore()
+{
+ // FIXME: this should be done by the contact list for itself.
+ if( d->message.from()->metaContact() && d->message.from()->metaContact()->isTemporary() &&
+ KopetePrefs::prefs()->balloonNotifyIgnoreClosesChatView() )
+ ContactList::self()->removeMetaContact( d->message.from()->metaContact() );
+ d->state = Ignored;
+ deleteLater();
+}
+
+void MessageEvent::accept()
+{
+ emit accepted(this);
+}
+
+void MessageEvent::discard()
+{
+ emit discarded(this);
+ delete this;
+}
+
+}
+
+#include "kopetemessageevent.moc"
+
+// vim: set noet ts=4 sts=4 sw=4:
+