You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
2.6 KiB
106 lines
2.6 KiB
/*
|
|
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, TQObject *parent, const char *name )
|
|
: TQObject(parent,name), d( new Private )
|
|
{
|
|
d->message = m;
|
|
d->state = Nothing;
|
|
const Contact *c=m.from();
|
|
if(c)
|
|
connect(c,TQT_SIGNAL(contactDestroyed( Kopete::Contact* )),this,TQT_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:
|
|
|