blob: ba8b22b544d26b05bdafba5eaeb3e88b19594b59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*
kopetemessageevent.cpp - Kopete Message Event
Copyright (c) 2003 by Olivier Goffart <ogoffart @ kde.org>
Copyright (c) 2002 by Duncan Mac-Vicar Prett <[email protected]>
Copyright (c) 2002 by Hendrik vom Lehn <[email protected]>
Copyright (c) 2002-2003 by Martijn Klingens <[email protected]>
Copyright (c) 2004 by Richard Smith <[email protected]>
Kopete (c) 2002-2003 by the Kopete developers <[email protected]>
*************************************************************************
* *
* 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,TQ_SIGNAL(contactDestroyed( Kopete::Contact* )),this,TQ_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"
|