1
#ifndef _KVI_CHANNEL_H_
2
#define _KVI_CHANNEL_H_
3
//=============================================================================
5
// File : kvi_channel.h
6
// Creation date : Tue Aug 1 2000 01:42:00 by Szymon Stefanek
8
// This file is part of the KVirc irc client distribution
9
// Copyright (C) 2000-2008 Szymon Stefanek (pragma at kvirc dot net)
11
// This program is FREE software. You can redistribute it and/or
12
// modify it under the terms of the GNU General Public License
13
// as published by the Free Software Foundation; either version 2
14
// of the License, or (at your opinion) any later version.
16
// This program is distributed in the HOPE that it will be USEFUL,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
// See the GNU General Public License for more details.
21
// You should have received a copy of the GNU General Public License
22
// along with this program. If not, write to the Free Software Foundation,
23
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
//=============================================================================
29
* \author Szymon Stefanek
30
* \brief Channel widget: abstraction of an IRC channel
33
#include "kvi_settings.h"
34
#include "kvi_console.h"
35
#include "kvi_window.h"
36
#include "kvi_string.h"
37
#include "kvi_ircuserdb.h"
38
#include "kvi_pixmap.h"
39
#include "kvi_userlistview.h"
41
#include "kvi_modew.h"
42
#include "kvi_pointerhashtable.h"
46
#include <QStringList>
47
#include <QToolButton>
58
#ifdef COMPILE_ON_WINDOWS
59
// windows compiler wants this instead of the forward decl
60
#include "kvi_maskeditor.h"
62
typedef struct _KviMaskEntry KviMaskEntry; // kvi_maskeditor.h
66
* \def KVI_CHANNEL_STATE_HAVEALLNAMES Flag for "have all names"
67
* \def KVI_CHANNEL_STATE_HAVEBANLIST Flag for "have ban list"
68
* \def KVI_CHANNEL_STATE_HAVEWHOLIST Flag for "have WHO list"
69
* \def KVI_CHANNEL_STATE_HAVEBANEXCEPTIONLIST Flag for "have ban exception list"
70
* \def KVI_CHANNEL_STATE_HAVEINVITELIST Flag for "have invite list"
71
* \def KVI_CHANNEL_STATE_HAVEQUIETBANLIST Flag for "have quiet ban list"
72
* \def KVI_CHANNEL_STATE_DEADCHAN Flag for "dead channel"
73
* \def KVI_CHANNEL_STATE_SENTBANLISTREQUEST Flag to set ban list request
74
* \def KVI_CHANNEL_STATE_SENTBANEXCEPTIONLISTREQUEST Flag to set ban exception list request
75
* \def KVI_CHANNEL_STATE_SENTINVITELISTREQUEST Flag to set invite list request
76
* \def KVI_CHANNEL_STATE_SENTQUIETBANLISTREQUEST Flag to set ban list request
77
* \def KVI_CHANNEL_STATE_SENTWHOREQUEST Flag to set WHO request
78
* \def KVI_CHANNEL_STATE_SENTPART Flag to set PART request
79
* \def KVI_CHANNEL_STATE_SYNCHRONIZED Flag to set SYNC request
80
* \def KVI_CHANNEL_STATE_NOCLOSEONPART Flag to set no close on part
81
* \def KVI_CHANNEL_STATE_SENTSYNCWHOREQUEST Flag for SYNC request
83
#define KVI_CHANNEL_STATE_HAVEALLNAMES 1
84
#define KVI_CHANNEL_STATE_HAVEBANLIST (1 << 1)
85
#define KVI_CHANNEL_STATE_HAVEWHOLIST (1 << 2)
86
#define KVI_CHANNEL_STATE_HAVEBANEXCEPTIONLIST (1 << 3)
87
#define KVI_CHANNEL_STATE_HAVEINVITELIST (1 << 4)
88
#define KVI_CHANNEL_STATE_HAVEQUIETBANLIST (1 << 5)
89
#define KVI_CHANNEL_STATE_DEADCHAN (1 << 6)
90
#define KVI_CHANNEL_STATE_SENTBANLISTREQUEST (1 << 7)
91
#define KVI_CHANNEL_STATE_SENTBANEXCEPTIONLISTREQUEST (1 << 8)
92
#define KVI_CHANNEL_STATE_SENTINVITELISTREQUEST (1 << 9)
93
#define KVI_CHANNEL_STATE_SENTQUIETBANLISTREQUEST (1 << 10)
94
#define KVI_CHANNEL_STATE_SENTWHOREQUEST (1 << 11)
95
#define KVI_CHANNEL_STATE_SENTPART (1 << 12)
96
#define KVI_CHANNEL_STATE_SYNCHRONIZED (1 << 13)
97
#define KVI_CHANNEL_STATE_NOCLOSEONPART (1 << 14)
98
#define KVI_CHANNEL_STATE_SENTSYNCWHOREQUEST (1 << 15)
101
* \def KVI_CHANACTIVITY_LIMIT_ICE The limit to be "ice"
102
* \def KVI_CHANACTIVITY_LIMIT_VERYCOLD The limit to be "very cold"
103
* \def KVI_CHANACTIVITY_LIMIT_COLD The limit to be "cold"
104
* \def KVI_CHANACTIVITY_LIMIT_UNDEFINED The limit to be "undefined"
105
* \def KVI_CHANACTIVITY_LIMIT_HOT The limit to be "hot"
106
* \def KVI_CHANACTIVITY_LIMIT_VERYHOT The limit to be "very hot"
108
#define KVI_CHANACTIVITY_LIMIT_ICE 5
109
#define KVI_CHANACTIVITY_LIMIT_VERYCOLD 10
110
#define KVI_CHANACTIVITY_LIMIT_COLD 20
111
#define KVI_CHANACTIVITY_LIMIT_UNDEFINED 30
112
#define KVI_CHANACTIVITY_LIMIT_HOT 50
113
#define KVI_CHANACTIVITY_LIMIT_VERYHOT 70
116
* \def AVERAGE_CHANNEL_USERS The average channel users of a channel
118
#ifndef AVERAGE_CHANNEL_USERS
119
#define AVERAGE_CHANNEL_USERS 101
123
* \def KVI_CHANNEL_ACTION_HISTORY_MAX_COUNT Maximum actions count we keep in memory
124
* \def KVI_CHANNEL_ACTION_HISTORY_MAX_TIMESPAN Timespan of the oldest action we keep in memory (600 secs = 10 mins)
126
#define KVI_CHANNEL_ACTION_HISTORY_MAX_COUNT 40
127
#define KVI_CHANNEL_ACTION_HISTORY_MAX_TIMESPAN 600
130
* \typedef KviChannelAction
131
* \struct _KviChannelAction
132
* \brief A struct which holds the channel actions
134
typedef struct _KviChannelAction
136
QString szNick; // action source nick
137
unsigned int uActionType; // type of the action
138
kvi_time_t tTime; // time of the action
139
int iTemperature; // temperature of the action
143
* \typedef KviChannelActivityStats
144
* \struct _KviChannelActivityStats
145
* \brief A struct which holds the activity stats
147
typedef struct _KviChannelActivityStats
149
unsigned int uActionCount; // number of actions in the history
150
bool bStatsInaccurate; // the stats are inaccurate because we have just joined the chan
151
unsigned int uLastActionTimeSpan; // the timespan between the last action and now
152
unsigned int uFirstActionTimeSpan; // the time span between the first and the last action
153
double dActionsPerMinute; // average number of actions per minute in the lastActionTimeSpan
154
unsigned int uActionsInTheLastMinute; // number of actions in the last minute
155
int iAverageActionTemperature; // the average chan temperature
156
unsigned int uHotActionCount;
157
unsigned int uHotActionPercent;
158
QStringList lTalkingUsers; // users that seem to be talking NOW
159
QStringList lWereTalkingUsers;
160
} KviChannelActivityStats;
164
* \brief The class which manages a channel
166
class KVIRC_API KviChannel : public KviWindow
171
* \brief Constructs the channel object
172
* \param lpFrm The parent frame object
173
* \param lpConsole The console of the context
174
* \param szName The name of the channel
177
KviChannel(KviFrame * lpFrm, KviConsole * lpConsole, const QString & szName);
180
* \brief Destroys the channel object
184
KviTalSplitter * m_pTopSplitter;
185
KviTalSplitter * m_pVertSplitter;
186
QToolButton * m_pDoubleViewButton;
187
KviWindowToolPageButton * m_pListViewButton;
188
KviWindowToolPageButton * m_pBanEditorButton;
189
KviWindowToolPageButton * m_pBanExceptionEditorButton;
190
KviWindowToolPageButton * m_pInviteEditorButton;
191
KviWindowToolPageButton * m_pQuietBanEditorButton;
192
KviWindowToolPageButton * m_pModeEditorButton;
193
KviMaskEditor * m_pBanEditor;
194
KviMaskEditor * m_pBanExceptionEditor;
195
KviMaskEditor * m_pInviteEditor;
196
KviMaskEditor * m_pQuietBanEditor;
197
KviModeEditor * m_pModeEditor;
198
KviIrcView * m_pMessageView;
199
KviTopicWidget * m_pTopicWidget;
200
KviUserListView * m_pUserListView;
201
KviModeWidget * m_pModeWidget;
203
QString m_szChannelMode;
204
QString m_szChannelKey;
205
QString m_szChannelLimit;
206
KviPointerList<KviMaskEntry> * m_pBanList;
207
KviPointerList<KviMaskEntry> * m_pBanExceptionList;
208
KviPointerList<KviMaskEntry> * m_pInviteList;
209
KviPointerList<KviMaskEntry> * m_pQuietBanList;
210
KviPixmap m_privateBackground;
211
QDateTime m_joinTime;
212
QString m_szNameWithUserFlag;
213
QStringList * m_pTmpHighLighted;
214
unsigned int m_uActionHistoryHotActionCount;
215
KviPointerList<KviChannelAction> * m_pActionHistory;
216
kvi_time_t m_tLastReceivedWhoReply;
217
QList<int> m_VertSplitterSizesList;
218
KviTalHBox * m_pButtonContainer;
221
* \brief Returns the user listview object
222
* \return KviUserListView *
224
KviUserListView * userListView(){ return m_pUserListView; };
227
* \brief Returns the topic widget object
228
* \return KviTopicWidget *
230
KviTopicWidget * topicWidget(){ return m_pTopicWidget; };
233
* \brief Returns the irc view object
234
* \return KviIrcView *
236
KviIrcView * messageView() const { return m_pMessageView; };
239
* \brief Returns the button container object
242
QFrame * buttonContainer() { return (QFrame*)m_pButtonContainer; };
245
* \brief Returns the list of bans set
246
* \return KviPointerList<KviMaskEntry> *
248
KviPointerList<KviMaskEntry> * banList(){ return m_pBanList; };
251
* \brief Returns the list of ban exceptions set
252
* \return KviPointerList<KviMaskEntry> *
254
KviPointerList<KviMaskEntry> * banExceptionList(){ return m_pBanExceptionList; };
257
* \brief Returns the list of invites set
258
* \return KviPointerList<KviMaskEntry> *
260
KviPointerList<KviMaskEntry> * inviteList(){ return m_pInviteList; };
263
* \brief Returns the list of quiet bans set
264
* \return KviPointerList<KviMaskEntry> *
266
KviPointerList<KviMaskEntry> * quietBanList(){ return m_pQuietBanList; };
269
* \brief Returns the first selected nickname in the userlist
272
QString * firstSelectedNickname(){ return m_pUserListView->firstSelectedNickname(); };
275
* \brief Returns the next selected nickname in the userlist
278
QString * nextSelectedNickname(){ return m_pUserListView->nextSelectedNickname(); };
281
* \brief Returns the name of the channel
282
* \return const QString &
284
virtual const QString & target(){ return windowName(); };
287
* \brief Returns the name of the channel with user flags
288
* \return const QString &
290
const QString & nameWithUserFlag(){ return m_szNameWithUserFlag; };
293
* \brief Gets the channel activity stats and put them in the buffer
294
* \param s The buffer where to store the data
297
void getChannelActivityStats(KviChannelActivityStats * s);
300
* \brief Returns the number of selected users
303
int selectedCount(){ return m_pUserListView->selectedCount(); };
306
* \brief Returns the number of users with chanowner status
309
int chanOwnerCount(){ return m_pUserListView->chanOwnerCount(); };
312
* \brief Returns the number of users with chanadmin status
315
int chanAdminCount(){ return m_pUserListView->chanAdminCount(); };
318
* \brief Returns the number of users with op status
321
int opCount(){ return m_pUserListView->opCount(); };
324
* \brief Returns the number of users with halfop status
327
int halfOpCount(){ return m_pUserListView->halfOpCount(); };
330
* \brief Returns the number of users with voice status
333
int voiceCount(){ return m_pUserListView->voiceCount(); };
336
* \brief Returns the number of users with userop status
339
int userOpCount(){ return m_pUserListView->userOpCount(); };
342
* \brief Returns the number of users
343
* \return unsigned int
345
unsigned int count(){ return m_pUserListView->count(); };
348
* \brief Returns the number of ban masks
349
* \return unsigned int
351
unsigned int banCount(){ return m_pBanList->count(); };
354
* \brief Returns the number of ban exceptions masks list
355
* \return unsigned int
357
unsigned int banExceptionCount(){ return m_pBanExceptionList->count(); };
360
* \brief Returns the number of invite masks
361
* \return unsigned int
363
unsigned int inviteCount(){ return m_pInviteList->count(); };
366
* \brief Returns the number of quiet ban masks
367
* \return unsigned int
369
unsigned int quietBanCount(){ return m_pQuietBanList->count(); };
372
* \brief Called when someone sets a mask in the channel's lists
374
* The type of the mask can be:
379
* \param cFlag The type of the mask
380
* \param szMask The mask set
381
* \param bAdd Whether to add or remove the mask
382
* \param szSetBy Who set the mask
383
* \param uSetAt The datetime when the mask was set
386
void setMask(char cFlag, const QString & szMask, bool bAdd, const QString & szSetBy, unsigned int uSetAt);
389
* \brief Returns the time of the last received WHO reply
392
kvi_time_t lastReceivedWhoReply(){ return m_tLastReceivedWhoReply; };
395
* \brief Sets the time of the last received WHO reply
396
* \param tTime The source time
399
void setLastReceivedWhoReply(kvi_time_t tTime){ m_tLastReceivedWhoReply = tTime; };
402
* \brief Returns true if we have sent the sync WHO request
405
bool sentSyncWhoRequest(){ return (m_iStateFlags & KVI_CHANNEL_STATE_SENTSYNCWHOREQUEST); };
408
* \brief Sets the sync WHO request flag
411
void setSentSyncWhoRequest(){ m_iStateFlags |= KVI_CHANNEL_STATE_SENTSYNCWHOREQUEST; };
414
* \brief Clears the sync WHO request flag
417
void clearSentSyncWhoRequest(){ m_iStateFlags ^= KVI_CHANNEL_STATE_SENTSYNCWHOREQUEST; };
420
* \brief Returns true if we have sent the WHO request
423
bool sentWhoRequest(){ return (m_iStateFlags & KVI_CHANNEL_STATE_SENTWHOREQUEST); };
426
* \brief Sets the WHO request flag
429
void setSentWhoRequest(){ m_iStateFlags |= KVI_CHANNEL_STATE_SENTWHOREQUEST; };
432
* \brief Returns true if we have sent the invite list request
435
bool sentInviteListRequest(){ return (m_iStateFlags & KVI_CHANNEL_STATE_SENTINVITELISTREQUEST); };
438
* \brief Sets the invite request flag
441
void setSentInviteListRequest(){ m_iStateFlags |= KVI_CHANNEL_STATE_SENTINVITELISTREQUEST; };
444
* \brief Clears the invite request flag
447
void setInviteListDone(){ m_iStateFlags ^= KVI_CHANNEL_STATE_SENTINVITELISTREQUEST; };
450
* \brief Returns true if we have sent the ban list request
453
bool sentBanListRequest(){ return (m_iStateFlags & KVI_CHANNEL_STATE_SENTBANLISTREQUEST); };
456
* \brief Sets the ban request flag
459
void setSentBanListRequest(){ m_iStateFlags |= KVI_CHANNEL_STATE_SENTBANLISTREQUEST; };
462
* \brief Clears the ban request flag
465
void setBanListDone(){ m_iStateFlags ^= KVI_CHANNEL_STATE_SENTBANLISTREQUEST; };
468
* \brief Returns true if we have sent the ban exception list request
471
bool sentBanExceptionListRequest(){ return (m_iStateFlags & KVI_CHANNEL_STATE_SENTBANEXCEPTIONLISTREQUEST); };
474
* \brief Sets the ban exception request flag
477
void setSentBanExceptionListRequest(){ m_iStateFlags |= KVI_CHANNEL_STATE_SENTBANEXCEPTIONLISTREQUEST; };
480
* \brief Clears the ban exception request flag
483
void setBanExceptionListDone(){ m_iStateFlags ^= KVI_CHANNEL_STATE_SENTBANEXCEPTIONLISTREQUEST; };
486
* \brief Returns true if we have sent the quiet ban list request
489
bool sentQuietBanListRequest(){ return (m_iStateFlags & KVI_CHANNEL_STATE_SENTQUIETBANLISTREQUEST); };
492
* \brief Sets the quiet ban request flag
495
void setSentQuietBanListRequest(){ m_iStateFlags |= KVI_CHANNEL_STATE_SENTQUIETBANLISTREQUEST; };
498
* \brief Clears the quiet ban request flag
501
void setQuietBanListDone(){ m_iStateFlags ^= KVI_CHANNEL_STATE_SENTQUIETBANLISTREQUEST; };
504
* \brief Returns true if the channel has all names
507
bool hasAllNames(){ return (m_iStateFlags & KVI_CHANNEL_STATE_HAVEALLNAMES); };
510
* \brief Sets the existance of all names
513
void setHasAllNames(){ m_iStateFlags |= KVI_CHANNEL_STATE_HAVEALLNAMES; checkChannelSync(); };
516
* \brief Returns true if the channel has an invite list
519
bool hasInviteList(){ return (m_iStateFlags & KVI_CHANNEL_STATE_HAVEINVITELIST); checkChannelSync(); };
522
* \brief Sets the existance of the invite list
525
void setHasInviteList(){ m_iStateFlags |= KVI_CHANNEL_STATE_HAVEINVITELIST; };
528
* \brief Returns true if the channel has a WHO list
531
bool hasWhoList(){ return (m_iStateFlags & KVI_CHANNEL_STATE_HAVEWHOLIST); };
534
* \brief Sets the existance of the WHO list
537
void setHasWhoList(){ m_iStateFlags |= KVI_CHANNEL_STATE_HAVEWHOLIST; checkChannelSync(); };
540
* \brief Returns true if the channel has a ban list
543
bool hasBanList(){ return (m_iStateFlags & KVI_CHANNEL_STATE_HAVEBANLIST); };
546
* \brief Sets the existance of the ban list
549
void setHasBanList(){ m_iStateFlags |= KVI_CHANNEL_STATE_HAVEBANLIST; checkChannelSync(); };
552
* \brief Returns true if the channel has a ban exception list
555
bool hasBanExceptionList(){ return (m_iStateFlags & KVI_CHANNEL_STATE_HAVEBANEXCEPTIONLIST); };
558
* \brief Sets the existance of the ban exception list
561
void setHasBanExceptionList(){ m_iStateFlags |= KVI_CHANNEL_STATE_HAVEBANEXCEPTIONLIST; checkChannelSync(); };
564
* \brief Returns true if the channel has a quiet ban list
567
bool hasQuietBanList(){ return (m_iStateFlags & KVI_CHANNEL_STATE_HAVEQUIETBANLIST); };
570
* \brief Sets the existance of the quiet ban list
573
void setHasQuietBanList(){ m_iStateFlags |= KVI_CHANNEL_STATE_HAVEQUIETBANLIST; checkChannelSync(); };
576
* \brief Returns true if the channel has to be closed on part
579
bool closeOnPart(){ return !(m_iStateFlags & KVI_CHANNEL_STATE_NOCLOSEONPART); };
582
* \brief Called when we want to part a channel
583
* \param bCloseOnPart Whether to leave channel open after part
584
* \param bShowMessage Whether to show part message
587
void partMessageSent(bool bCloseOnPart = true, bool bShowMessage = true);
590
* \brief Colors the icon who tells how much activity there is
591
* \param puActivityValue The value of the activity
592
* \param puActivityTemperature The temperature of the activity
595
virtual bool activityMeter(unsigned int * puActivityValue, unsigned int * puActivityTemperature);
598
* \brief Sets the channel as dead
604
* \brief Returns true if the channel is dead
607
bool isDeadChan(){ return (m_iStateFlags & KVI_CHANNEL_STATE_DEADCHAN); };
610
* \brief Sets the channel as alive
616
* \brief Prepends the user flag to the nickname
617
* \param szNick The nickname of the user
618
* \param szBuffer The buffer :)
621
void prependUserFlag(const QString & szNick, QString & szBuffer){ m_pUserListView->prependUserFlag(szNick,szBuffer); };
624
* \brief Returns the flag of a user
625
* \param szNick The nick of the user
628
char getUserFlag(const QString & szNick){ return m_pUserListView->getUserFlag(szNick); };
631
* \brief Returns the size of the channel
634
virtual QSize sizeHint() const;
637
* \brief Enables or disable the userlist updates
638
* \param bEnable Whether to enable the updates
641
void enableUserListUpdates(bool bEnable){ m_pUserListView->enableUpdates(bEnable); };
644
* \brief Called when a user joins the channel
645
* \param szNick The nickname of the user
646
* \param szUser The username of the user
647
* \param szHost The hostname of the user
648
* \param iFlags The flags of the user
649
* \return KviUserListEntry *
651
KviUserListEntry * join(const QString & szNick, const QString & szUser = QString(), const QString & szHost = QString(), int iFlags = 0){ return m_pUserListView->join(szNick,szUser,szHost,iFlags); };
654
* \brief Returns true if the avatar of a user is changed
655
* \param szNick The nickname of the user
658
bool avatarChanged(const QString & szNick){ return m_pUserListView->avatarChanged(szNick); };
661
* \brief Sets the chan owner mode
662
* \param szNick The nick to set the mode on
663
* \param bChanOwner Whether to set or unset the mode on the user
666
bool setChanOwner(const QString & szNick, bool bChanOwner){ return m_pUserListView->setChanOwner(szNick,bChanOwner); };
669
* \brief Sets the chan admin mode
670
* \param szNick The nick to set the mode on
671
* \param bChanAdmin Whether to set or unset the mode on the user
674
bool setChanAdmin(const QString & szNick, bool bChanAdmin){ return m_pUserListView->setChanAdmin(szNick,bChanAdmin); };
677
* \brief Sets the operator mode
678
* \param szNick The nick to set the mode on
679
* \param bOp Whether to set or unset the mode on the user
682
bool setOp(const QString & szNick, bool bOp){ return m_pUserListView->setOp(szNick,bOp); };
685
* \brief Sets the half operator mode
686
* \param szNick The nick to set the mode on
687
* \param bHalfOp Whether to set or unset the mode on the user
690
bool setHalfOp(const QString & szNick, bool bHalfOp){ return m_pUserListView->setHalfOp(szNick,bHalfOp); };
693
* \brief Sets the voice mode
694
* \param szNick The nick to set the mode on
695
* \param bVoice Whether to set or unset the mode on the user
698
bool setVoice(const QString & szNick, bool bVoice){ return m_pUserListView->setVoice(szNick,bVoice); };
701
* \brief Sets the user operator mode
702
* \param szNick The nick to set the mode on
703
* \param bUserOp Whether to set or unset the mode on the user
706
bool setUserOp(const QString & szNick, bool bUserOp){ return m_pUserListView->setUserOp(szNick,bUserOp); };
709
* \brief Returns true if the user is a chan owner
710
* \param szNick The nickname of the user to check
711
* \param bAtLeast Whether the user is at least a chan owner
714
bool isChanOwner(const QString & szNick, bool bAtLeast = false){ return m_pUserListView->isChanOwner(szNick,bAtLeast); };
717
* \brief Returns true if the user is a chan admin
718
* \param szNick The nickname of the user to check
719
* \param bAtLeast Whether the user is at least a chan admin
722
bool isChanAdmin(const QString & szNick, bool bAtLeast = false){ return m_pUserListView->isChanAdmin(szNick,bAtLeast); };
725
* \brief Returns true if the user is an operator
726
* \param szNick The nickname of the user to check
727
* \param bAtLeast Whether the user is at least an operator
730
bool isOp(const QString & szNick, bool bAtLeast = false){ return m_pUserListView->isOp(szNick,bAtLeast); };
733
* \brief Returns true if the user is a half operator
734
* \param szNick The nickname of the user to check
735
* \param bAtLeast Whether the user is at least a half operator
738
bool isHalfOp(const QString & szNick, bool bAtLeast = false){ return m_pUserListView->isHalfOp(szNick,bAtLeast); };
741
* \brief Returns true if the user is a voice
742
* \param szNick The nickname of the user to check
743
* \param bAtLeast Whether the user is at least a voice
746
bool isVoice(const QString & szNick, bool bAtLeast = false){ return m_pUserListView->isVoice(szNick,bAtLeast); };
749
* \brief Returns true if the user is a user operator
750
* \param szNick The nickname of the user to check
751
* \param bAtLeast Whether the user is at least a user operator
754
bool isUserOp(const QString & szNick, bool bAtLeast = false){ return m_pUserListView->isUserOp(szNick,bAtLeast); };
757
* \brief Returns true if we are an ircop
758
* \param bAtLeast Whether we are at least an ircop
761
bool isMeIrcOp(bool bAtLeast = false);
764
* \brief Returns true if we are a chan owner
765
* \param bAtLeast Whether we are at least a chan owner
768
bool isMeChanOwner(bool bAtLeast = false);
771
* \brief Returns true if we are a chan admin
772
* \param bAtLeast Whether we are at least a chan admin
775
bool isMeChanAdmin(bool bAtLeast = false);
778
* \brief Returns true if we are an operator
779
* \param bAtLeast Whether we are at least an operator
782
bool isMeOp(bool bAtLeast = false);
785
* \brief Returns true if we are a half operator
786
* \param bAtLeast Whether we are at least a half operator
789
bool isMeHalfOp(bool bAtLeast = false);
792
* \brief Returns true if we are a voice
793
* \param bAtLeast Whether we are at least a voice
796
bool isMeVoice(bool bAtLeast = false);
799
* \brief Returns true if we are a user operator
800
* \param bAtLeast Whether we are at least a user operator
803
bool isMeUserOp(bool bAtLeast = false);
806
* \brief Perform a user action in the channel
807
* \param user The user who made the action
808
* \param uActionType The type of the action
811
void userAction(KviIrcMask * user, unsigned int uActionType);
814
* \brief Perform a user action in the channel
815
* \param szNick The nickname of the user who made the action
816
* \param uActionType The type of the action
819
void userAction(const QString & szNick, unsigned int uActionType);
822
* \brief Perform a user action in the channel
823
* \param szNick The nickname of the user who made the action
824
* \param szUser The username of the user who made the action
825
* \param szHost The hostname of the user who made the action
826
* \param uActionType The type of the action
829
void userAction(const QString & szNick, const QString & szUser, const QString & szHost, unsigned int uActionType);
832
* \brief Called when someone perform an action in the channel
833
* \param szNick The nickname of the user who made the action
834
* \param uActionType The type of the action
835
* \param iTemperature The temperature of the action
838
void channelAction(const QString & szNick, unsigned int uActionType, int iTemperature);
841
* \brief Called when someone changes his nick
842
* \param szOldNick The old nickname of the user
843
* \param szNewNick The new nickname of the user
846
bool nickChange(const QString & szOldNick, const QString & szNewNick);
849
* \brief Called when someone parts the channel
850
* \param szNick The nickname of the user who parts
853
bool part(const QString & szNick);
856
* \brief Returns true if the user is on the channel
857
* \param szNick The nickname of the user
860
bool isOn(const QString & szNick){ return (m_pUserListView->findEntry(szNick) != 0); };
863
* \brief Searches for a user in the userlist
864
* \param szNick The nickname of the user to find
865
* \return KviUserListEntry *
867
KviUserListEntry * findEntry(const QString & szNick){ return m_pUserListView->findEntry(szNick); };
870
* \brief Returns our flags
876
* \brief Updates the tooltip over the channel modes
879
void updateModeLabel();
882
* \brief Outputs a message to the channel window
883
* \param iMsgType The type of the message
884
* \param szMsg The message :)
887
virtual void outputMessage(int iMsgType, const QString & szMsg);
890
* \brief Called when we send a message
891
* \param szBuffer The buffer :)
894
void ownMessage(const QString & szBuffer);
897
* \brief Called when we perform an action
898
* \param szBuffer The buffer :)
901
void ownAction(const QString & szBuffer);
904
* \brief Sets the channel mode
905
* \param cMode The mode to set
906
* \param bAdd Whether to add or remove the mode
909
void setChannelMode(char cMode, bool bAdd);
912
* \brief Returns the channel mode
915
QString channelMode() { return m_szChannelMode; };
918
* \brief Gets the channel mode string and saves it in the buffer
919
* \param szBuffer The buffer :)
922
void getChannelModeString(QString & szBuffer);
925
* \brief Sets the limit for the channel
926
* \param pcLimit The limit of the channel
929
void setChannelLimit(const char * pcLimit);
932
* \brief Returns true if the channel has a limit set
935
bool hasChannelLimit(){ return !m_szChannelLimit.isEmpty(); };
938
* \brief Returns the limit number
941
QString & channelLimit(){ return m_szChannelLimit; };
944
* \brief Sets the key for the channel
945
* \param pcKey The key of the channel
948
void setChannelKey(const char * pcKey);
951
* \brief Returns true if the channel has a key set
954
bool hasChannelKey() { return !m_szChannelKey.isEmpty(); };
957
* \brief Returns the channel key
960
QString & channelKey(){ return m_szChannelKey; };
963
* \brief Adds a user to the highlight list
964
* \param szNick The nickname of the user
967
void addHighlightedUser(const QString & szNick);
970
* \brief Removes a user from the highlight list
971
* \param szNick The nickname of the user
974
void removeHighlightedUser(const QString & szNick);
977
* \brief Returns true if the user is highlighted
978
* \param szNick The nickname of the user
981
bool isHighlightedUser(const QString & szNick) { return m_pTmpHighLighted->contains(szNick,Qt::CaseInsensitive); };
984
* \brief Called when the channel losts the focus by the user
987
virtual void lostUserFocus();
990
* \brief Creates the tooltip over the channel treeview
991
* \param szBuffer The buffer where to store the data
994
virtual void getWindowListTipText(QString & szBuffer);
997
* \brief Unhighlights the windowlist item
1003
* \brief Pastes the most recent channel log into the buffer
1005
* It searches for the most recent channel log of the channel we have just
1006
* joined, and pastes into the buffer the last N lines, where N is get from
1010
void pasteLastLog();
1013
* \brief Loads a log file
1015
* It opens a logfile, gzipped or not, and returns the content in a buffer
1016
* \param szFileName The filename of the log file
1017
* \param bGzip Whether the log file is gzipped
1018
* \return QByteArray
1020
QByteArray loadLogFile(const QString & szFileName, bool bGzip);
1023
* \brief Filters the events
1024
* \param o The object
1025
* \param e The event
1028
bool eventFilter(QObject * o, QEvent * e);
1031
* \brief Returns the correct icon for the channel
1034
virtual QPixmap * myIconPtr();
1037
* \brief Fills in the caption buffers
1040
virtual void fillCaptionBuffers();
1043
* \brief Gets the group name
1044
* \param szBuffer The buffer where to save the data
1047
virtual void getConfigGroupName(QString & szBuffer);
1050
* \brief Saves the properties to file
1051
* \param cfg The config file
1054
virtual void saveProperties(KviConfig * cfg);
1057
* \brief Loads the properties from file
1058
* \param cfg The config file
1061
virtual void loadProperties(KviConfig * cfg);
1064
* \brief Applies the options
1067
virtual void applyOptions();
1070
* \brief Gets the base name for log file
1071
* \param szBuffer The buffer where to save data
1074
virtual void getBaseLogFileName(QString & szBuffer);
1077
* \brief Trigger the OnChannelWindowCreated event
1080
virtual void triggerCreationEvents();
1083
* \brief Called when we toggle bans, quiet bans, exceptions or invites editor
1084
* \param ppEd The mask editor
1085
* \param ppBtn The toolpage button
1086
* \param l The masks list
1087
* \param cFlag The type of flag
1088
* \param pcEdName Tee editor name
1091
void toggleEditor(KviMaskEditor ** ppEd, KviWindowToolPageButton ** ppBtn, KviPointerList<KviMaskEntry> * l, char cFlag, const char * pcEdName);
1094
* \brief Called when someone sets a mask in the channel's lists
1095
* \param szMask The mask set
1096
* \param bAdd Whether to add or remove the mask
1097
* \param szSetBy Who set the mask
1098
* \param uSetAt The datetime when the mask was set
1099
* \param l The list of masks in the channel lists
1100
* \param ppEd The mask editor window
1103
void internalMask(const QString & szMask, bool bAdd, const QString & szSetBy, unsigned int uSetAt, KviPointerList<KviMaskEntry> * l, KviMaskEditor ** ppEd);
1106
* \brief Checks the channel synchronization time
1109
void checkChannelSync();
1112
* \brief Splits the channel view into two views
1114
* The upper one will be used to show all system messages like join,
1115
* parts, quits, topics and so on, while the lower one will be used to
1116
* show the users messages.
1117
* \param bShow Whether to show the double view
1120
void showDoubleView(bool bShow);
1123
* \brief Fixes the action history
1126
void fixActionHistory();
1129
* \brief Gets the talking user stats to fill in the tooltip
1130
* \param szBuffer The buffer where to store the data
1131
* \param list The list of talking users
1132
* \param bPast Whether the activity is recent or in the past
1135
void getTalkingUsersStats(QString & szBuffer, QStringList & list, bool bPast);
1138
* \brief Preprocess message stripping control bytes
1139
* \param szMessage The message :)
1142
virtual void preprocessMessage(QString & szMessage);
1144
virtual void resizeEvent(QResizeEvent * e);
1145
virtual void closeEvent(QCloseEvent * e);
1148
* \brief Toggles the double view mode
1151
void toggleDoubleView();
1154
* \brief Toggles the userlist view
1157
void toggleListView();
1160
* \brief Toggles the ban editor
1163
void toggleBanEditor();
1166
* \brief Toggles the ban exception editor
1169
void toggleBanExceptionEditor();
1172
* \brief Toggles the invite editor
1175
void toggleInviteEditor();
1178
* \brief Toggles the quiet ban editor
1181
void toggleQuietBanEditor();
1184
* \brief Toggles the mode editor
1187
void toggleModeEditor();
1190
* \brief Called when we close the mode editor
1192
void modeSelectorDone();
1195
* \brief Called when we select the topic
1196
* \param szTopic The topic :)
1199
void topicSelected(const QString & szTopic);
1202
* \brief Called when we select the modes from the mode editor
1203
* \param pcMode The modes selected
1206
void setMode(const char * pcMode);
1209
* \brief Called when we right-click the irc view.
1211
* Trigger the OnChannelPopupRequest event
1214
void textViewRightClicked();
1217
* \brief Removes the masks from the mask editor window
1218
* \param pEd The mask editor
1219
* \param pList The list of masks to remove
1222
void removeMasks(KviMaskEditor * pEd, KviPointerList<KviMaskEntry> * pList);
1225
* \brief Toggles tool buttons widget over the listview
1228
void toggleToolButtons();
1231
#endif //_KVI_CHANNEL_H_