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
|
/*
ircchannelcontact.h - IRC Channel Contact
Copyright (c) 2002 by Nick Betcher <[email protected]>
Copyright (c) 2003 by Jason Keirstead <[email protected]>
Kopete (c) 2002 by the Kopete developers <[email protected]>
*************************************************************************
* *
* 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 IRCCHANNELCONTACT_H
#define IRCCHANNELCONTACT_H
#include "irccontact.h"
class TDEActionCollection;
class TDEAction;
class TDEActionMenu;
class KCodecAction;
class TDEToggleAction;
namespace Kopete { class MetaContact; }
namespace Kopete { class ChatSession; }
namespace Kopete { class Message; }
class KopeteView;
class IRCAccount;
class IRCContactManager;
/**
* @author Jason Keirstead <[email protected]>
*
* This class is the @ref Kopete::Contact object representing IRC Channels, not users.
* It is derived from IRCContact where much of its functionality is shared with @ref IRCUserContact.
*/
class IRCChannelContact
: public IRCContact
{
friend class IRCSignalMapper;
TQ_OBJECT
public:
IRCChannelContact(IRCContactManager *, const TQString &channel, Kopete::MetaContact *metac);
~IRCChannelContact();
/**
* Returns the current topic for this channel.
*/
const TQString &topic() const { return mTopic; };
/* Set password for a channel */
void setPassword(const TQString &password) { mPassword = password; }
/* Get password for a channel */
const TQString &password() const { return mPassword; }
/**
* Returns if a mode is enabled for this channel.
* @param mode The mode you want to check ( 't', 'n', etc. )
* @param value This is a pointer to a TQString which is set to
* the value of the mode if it has one. Example, the mode 'l' or
* the mode 'k'. If the mode has no such value then the pointer
* is always returned null.
*/
bool modeEnabled( TQChar mode, TQString *value = 0 );
// Kopete::Contact stuff
virtual TQPtrList<TDEAction> *customContextMenuActions();
virtual const TQString caption() const;
//Methods handled by the signal mapper
void userJoinedChannel(const TQString &user);
void userPartedChannel(const TQString &user, const TQString &reason);
void userKicked(const TQString &nick, const TQString &nickKicked, const TQString &reason);
void channelTopic(const TQString &topic);
void channelHomePage(const TQString &url);
void topicChanged(const TQString &nick, const TQString &newtopic);
void topicUser(const TQString &nick, const TQDateTime &time);
void namesList(const TQStringList &nicknames);
void endOfNames();
void incomingModeChange(const TQString &nick, const TQString &mode);
void incomingChannelMode(const TQString &mode, const TQString ¶ms );
void failedChankey();
void failedChanBanned();
void failedChanInvite();
void failedChanFull();
void newAction(const TQString &from, const TQString &action);
public slots:
void updateStatus();
/**
* Sets the topic of this channel
* @param topic The topic you want set
*/
void setTopic( const TQString &topic = TQString() );
/**
* Sets or unsets a mode on this channel
* @param mode The full text of the mode change you want performed
*/
void setMode( const TQString &mode = TQString() );
void part();
void partAction();
void join();
protected slots:
void chatSessionDestroyed();
virtual void privateMessage(IRCContact *from, IRCContact *to, const TQString &message);
virtual void initConversation();
private slots:
void slotIncomingUserIsAway( const TQString &nick, const TQString &reason );
void slotModeChanged();
void slotAddNicknames();
void slotConnectedToServer();
void slotUpdateInfo();
void slotHomepage();
void slotChannelListed(const TQString &channel, uint members, const TQString &topic);
void slotOnlineStatusChanged(Kopete::Contact *c, const Kopete::OnlineStatus &status, const Kopete::OnlineStatus &oldStatus);
private:
TDEAction *actionJoin;
TDEAction *actionPart;
TDEAction *actionTopic;
TDEAction *actionHomePage;
TDEActionMenu *actionModeMenu;
KCodecAction *codecAction;
TDEToggleAction *actionModeT; // Only Operators Can Change Topic
TDEToggleAction *actionModeN; // No Outside Messages
TDEToggleAction *actionModeS; // Secret
TDEToggleAction *actionModeI; // Invite Only
TDEToggleAction *actionModeM; // Moderated
TQString mTopic;
TQString mPassword;
TQStringList mJoinedNicks;
TQMap<TQString, bool> modeMap;
TQTimer *mInfoTimer;
void toggleMode( TQChar mode, bool enabled, bool update );
void toggleOperatorActions( bool enabled );
};
#endif
|