Bonjour nick name is in Latin1 encoding
[kdenetwork.git] / kopete / protocols / irc / irccontact_channel.h
blobc1b723364cc2bc955ea8fe5c562fa2a0ba1ed72f
1 /*
2 ircchannelcontact.h - IRC Channel Contact
4 Copyright (c) 2002 by Nick Betcher <nbetcher@kde.org>
5 Copyright (c) 2003 by Jason Keirstead <jason@keirstead.org>
7 Kopete (c) 2002 by the Kopete developers <kopete-devel@kde.org>
9 *************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 *************************************************************************
19 #ifndef IRCCONTACT_CHANNEL_H
20 #define IRCCONTACT_CHANNEL_H
22 #include "irccontact.h"
23 #include <QList>
25 class KAction;
26 class KActionMenu;
27 class KCodecAction;
28 class KToggleAction;
30 class IRCAccount;
32 namespace Kopete
34 class MetaContact;
37 /**
38 * @author Jason Keirstead <jason@keirstead.org>
40 * This class is the @ref Kopete::Contact object representing IRC Channels, not users.
41 * It is derrived from IRCContact where much of its functionality is shared with @ref IRCUserContact.
43 class IRCChannelContact
44 : public IRCContact
46 friend class IRCSignalMapper;
48 public:
49 IRCChannelContact(IRCAccount *, KIRC::EntityPtr entity, Kopete::MetaContact *metac);
50 ~IRCChannelContact();
52 /**
53 * Returns the current topic for this channel.
55 const QString &topic() const { return mTopic; };
57 /* Set password for a channel */
58 void setPassword(const QString &password) { mPassword = password; }
59 /* Get password for a channel */
60 const QString &password() const { return mPassword; }
62 /**
63 * Returns if a mode is enabled for this channel.
64 * @param mode The mode you want to check ( 't', 'n', etc. )
65 * @param value This is a pointer to a QString which is set to
66 * the value of the mode if it has one. Example, the mode 'l' or
67 * the mode 'k'. If the mode has no such value then the pointer
68 * is always returned null.
70 bool modeEnabled( QChar mode, QString *value = 0 );
72 // Kopete::Contact stuff
73 virtual QList<KAction*> *customContextMenuActions();
74 virtual const QString caption() const;
76 //Methods handled by the signal mapper
77 void userJoinedChannel(const QString &user);
78 void userPartedChannel(const QString &user, const QString &reason);
79 void userKicked(const QString &nick, const QString &nickKicked, const QString &reason);
80 void channelTopic(const QString &topic);
81 void channelHomePage(const QString &url);
82 void topicChanged(const QString &nick, const QString &newtopic);
83 void topicUser(const QString &nick, const QDateTime &time);
84 void namesList(const QStringList &nicknames);
85 void endOfNames();
86 void incomingModeChange(const QString &nick, const QString &mode);
87 void incomingChannelMode(const QString &mode, const QString &params );
88 void failedChankey();
89 void failedChanBanned();
90 void failedChanInvite();
91 void failedChanFull();
93 public slots:
94 void updateStatus();
96 /**
97 * Sets the topic of this channel
98 * @param topic The topic you want set
100 void setTopic( const QString &topic = QString() );
103 * Sets or unsets a mode on this channel
104 * @param mode The full text of the mode change you want performed
106 void setMode( const QString &mode = QString() );
108 void part();
110 void join();
112 protected slots:
113 void chatSessionDestroyed();
115 virtual void initConversation();
117 private slots:
118 void slotIncomingUserIsAway( const QString &nick, const QString &reason );
119 void slotModeChanged();
120 void slotAddNicknames();
121 void slotConnectedToServer();
122 void slotUpdateInfo();
123 void slotHomepage();
124 void slotChannelListed(const QString &channel, uint members, const QString &topic);
126 private:
127 // KAction stuff:
128 KAction *actionJoin;
129 KAction *actionPart;
130 KAction *actionTopic;
131 KAction *actionHomePage;
132 KActionMenu *actionModeMenu;
133 KCodecAction *codecAction;
135 KToggleAction *actionModeT;
136 KToggleAction *actionModeN;
137 KToggleAction *actionModeS;
138 KToggleAction *actionModeI;
139 KToggleAction *actionModeP;
140 KToggleAction *actionModeM;
141 KToggleAction *actionModeB;
143 QString mTopic;
144 QString mPassword;
145 QStringList mJoinedNicks;
146 QMap<QString,bool> modeMap;
147 QTimer *mInfoTimer;
149 void toggleMode( QChar mode, bool enabled, bool update );
152 #endif // IRCCONTACT_CHANNEL_H