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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
/*
ircsignalhandler.cpp - Maps signals from the IRC engine to contacts
Copyright (c) 2004 by Jason Keirstead <jason@keirstead.org>
Kopete (c) 2002-2003 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. *
* *
*************************************************************************
*/
#include "ircusercontact.h"
#include "ircchannelcontact.h"
#include "ircsignalhandler.h"
#include "kircengine.h"
IRCSignalHandler::IRCSignalHandler(IRCContactManager *m)
: TQObject(m),
manager(m)
{
KIRC::Engine *m_engine = static_cast<IRCAccount*>( manager->mySelf()->account() )->engine();
//Channel Connections to ourself
TQObject::connect(m_engine, TQT_SIGNAL(incomingNamesList(const TQString &, const TQStringList &)),
this, TQT_SLOT(slotNamesList(const TQString &, const TQStringList &)));
TQObject::connect(m_engine, TQT_SIGNAL(incomingEndOfNames(const TQString &)),
this, TQT_SLOT(slotEndOfNames(const TQString &)));
TQObject::connect(m_engine, TQT_SIGNAL(incomingTopicUser(const TQString &, const TQString &, const TQDateTime &)),
this, TQT_SLOT(slotTopicUser(const TQString&,const TQString&,const TQDateTime&)));
//Channel String mappings
map<IRCChannelContact>( m, TQT_SIGNAL(incomingFailedChankey(const TQString &)),
&IRCChannelContact::failedChankey );
map<IRCChannelContact>( m, TQT_SIGNAL(incomingFailedChanFull(const TQString &)),
&IRCChannelContact::failedChanInvite );
map<IRCChannelContact>( m, TQT_SIGNAL(incomingFailedChanInvite(const TQString &)),
&IRCChannelContact::failedChanInvite );
map<IRCChannelContact>( m, TQT_SIGNAL(incomingFailedChanBanned(const TQString &)),
&IRCChannelContact::failedChanBanned );
mapSingle<IRCChannelContact>( m, TQT_SIGNAL(incomingJoinedChannel(const TQString &, const TQString &)),
&IRCChannelContact::userJoinedChannel );
mapSingle<IRCChannelContact>( m, TQT_SIGNAL(incomingExistingTopic(const TQString &, const TQString &)),
&IRCChannelContact::channelTopic );
mapSingle<IRCChannelContact>( m, TQT_SIGNAL(incomingChannelHomePage(const TQString &, const TQString &)),
&IRCChannelContact::channelHomePage );
mapDouble<IRCChannelContact>( m,
TQT_SIGNAL(incomingPartedChannel(const TQString &, const TQString &,const TQString &)),
&IRCChannelContact::userPartedChannel );
mapDouble<IRCChannelContact>( m,
TQT_SIGNAL(incomingTopicChange(const TQString &, const TQString &,const TQString &)),
&IRCChannelContact::topicChanged );
mapDouble<IRCChannelContact>( m,
TQT_SIGNAL(incomingChannelModeChange(const TQString &, const TQString &,const TQString &)),
&IRCChannelContact::incomingModeChange );
mapDouble<IRCChannelContact>( m,
TQT_SIGNAL(incomingChannelMode(const TQString &, const TQString &,const TQString &)),
&IRCChannelContact::incomingChannelMode );
mapTriple<IRCChannelContact>( m,
TQT_SIGNAL(incomingKick(const TQString &, const TQString &,const TQString &,const TQString &)),
&IRCChannelContact::userKicked );
//User connections to ourself
TQObject::connect(m_engine, TQT_SIGNAL(incomingWhoIsIdle(const TQString &, unsigned long )),
this, TQT_SLOT(slotNewWhoIsIdle(const TQString &, unsigned long )));
TQObject::connect(m_engine, TQT_SIGNAL(incomingWhoReply(const TQString &, const TQString &, const TQString &,
const TQString &, const TQString &, bool, const TQString &, uint, const TQString & )),
this, TQT_SLOT( slotNewWhoReply(const TQString &, const TQString &, const TQString &, const TQString &,
const TQString &, bool, const TQString &, uint, const TQString &)));
//User signal mappings
map<IRCUserContact>( m, TQT_SIGNAL(incomingUserOnline( const TQString & )), &IRCUserContact::userOnline );
map<IRCUserContact>( m, TQT_SIGNAL(incomingWhoIsOperator( const TQString & )), &IRCUserContact::newWhoIsOperator );
map<IRCUserContact>( m, TQT_SIGNAL(incomingWhoIsIdentified( const TQString & )), &IRCUserContact::newWhoIsIdentified );
map<IRCUserContact>( m, TQT_SIGNAL(incomingEndOfWhois( const TQString & )), &IRCUserContact::whoIsComplete );
map<IRCUserContact>( m, TQT_SIGNAL(incomingEndOfWhoWas( const TQString & )), &IRCUserContact::whoWasComplete );
mapSingle<IRCUserContact>( m, TQT_SIGNAL(incomingUserIsAway( const TQString &, const TQString & )),
&IRCUserContact::incomingUserIsAway );
mapSingle<IRCUserContact>( m, TQT_SIGNAL(incomingWhoIsChannels( const TQString &, const TQString & )),
&IRCUserContact::newWhoIsChannels );
mapDouble<IRCUserContact>( m,
TQT_SIGNAL(incomingWhoIsServer(const TQString &, const TQString &, const TQString &)),
&IRCUserContact::newWhoIsServer );
mapDouble<IRCUserContact>( m,
TQT_SIGNAL(incomingPrivAction(const TQString &, const TQString &, const TQString &)),
&IRCUserContact::newAction );
mapDouble<IRCChannelContact>( m,
TQT_SIGNAL(incomingAction(const TQString &, const TQString &, const TQString &)),
&IRCChannelContact::newAction );
mapTriple<IRCUserContact>( m,
TQT_SIGNAL(incomingWhoIsUser(const TQString &, const TQString &, const TQString &, const TQString &)),
&IRCUserContact::newWhoIsUser );
mapTriple<IRCUserContact>( m,
TQT_SIGNAL(incomingWhoWasUser(const TQString &, const TQString &, const TQString &, const TQString &)),
&IRCUserContact::newWhoIsUser );
}
IRCSignalHandler::~IRCSignalHandler()
{
//Delete our mapping pointers
for( TQValueList<IRCSignalMappingBase*>::iterator it = mappings.begin(); it != mappings.end(); ++it )
delete *it;
}
void IRCSignalHandler::slotNamesList( const TQString &chan, const TQStringList &list )
{
IRCChannelContact *c = manager->existChannel( chan );
if( c )
c->namesList( list );
}
void IRCSignalHandler::slotEndOfNames( const TQString &chan )
{
IRCChannelContact *c = manager->existChannel( chan );
if ( c )
c->endOfNames();
}
void IRCSignalHandler::slotTopicUser(const TQString &chan, const TQString &user,const TQDateTime &time)
{
IRCChannelContact *c = manager->existChannel( chan );
if( c )
c->topicUser( user, time );
}
void IRCSignalHandler::slotNewWhoIsIdle(const TQString &nick, unsigned long val )
{
IRCUserContact *c = manager->findUser( nick );
if( c )
c->newWhoIsIdle( val );
}
void IRCSignalHandler::slotNewWhoReply(const TQString &nick, const TQString &arg1, const TQString &arg2,
const TQString &arg3, const TQString &arg4, bool arg5, const TQString &arg6, uint arg7, const TQString &arg8 )
{
IRCUserContact *c = manager->findUser( nick );
if( c )
c->newWhoReply( arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 );
}
#include "ircsignalhandler.moc"
|