2 * Copyright (C) 2004-2011 See the AUTHORS file for details.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published
6 * by the Free Software Foundation.
12 #include "zncconfig.h"
16 // Forward Declarations
20 // !Forward Declarations
22 class CIRCSock
: public CZNCSock
{
24 CIRCSock(CUser
* pUser
);
28 // These values must line up with their position in the CHANMODE argument to raw 005
36 bool OnCTCPReply(CNick
& Nick
, CString
& sMessage
);
37 bool OnPrivCTCP(CNick
& Nick
, CString
& sMessage
);
38 bool OnChanCTCP(CNick
& Nick
, const CString
& sChan
, CString
& sMessage
);
39 bool OnGeneralCTCP(CNick
& Nick
, CString
& sMessage
);
40 bool OnPrivMsg(CNick
& Nick
, CString
& sMessage
);
41 bool OnChanMsg(CNick
& Nick
, const CString
& sChan
, CString
& sMessage
);
42 bool OnPrivNotice(CNick
& Nick
, CString
& sMessage
);
43 bool OnChanNotice(CNick
& Nick
, const CString
& sChan
, CString
& sMessage
);
44 bool OnServerCapAvailable(const CString
& sCap
);
47 virtual void ReadLine(const CString
& sData
);
48 virtual void Connected();
49 virtual void Disconnected();
50 virtual void ConnectionRefused();
51 virtual void SockError(int iErrno
);
52 virtual void Timeout();
53 virtual void ReachedMaxBuffer();
55 void PutIRC(const CString
& sLine
);
57 void Quit(const CString
& sQuitMsg
= "");
59 /** You can call this from CModule::OnServerCapResult to suspend
60 * sending other CAP requests and CAP END for a while. Each
61 * call to PauseCap should be balanced with a call to ResumeCap.
64 /** If you used PauseCap, call this when CAP negotiation and logging in
65 * should be resumed again.
70 void SetPass(const CString
& s
) { m_sPass
= s
; }
74 unsigned int GetMaxNickLen() const { return m_uMaxNickLen
; }
75 EChanModeArgs
GetModeType(unsigned char uMode
) const;
76 unsigned char GetPermFromMode(unsigned char uMode
) const;
77 const map
<unsigned char, EChanModeArgs
>& GetChanModes() const { return m_mueChanModes
; }
78 bool IsPermChar(const char c
) const { return (c
!= '\0' && GetPerms().find(c
) != CString::npos
); }
79 bool IsPermMode(const char c
) const { return (c
!= '\0' && GetPermModes().find(c
) != CString::npos
); }
80 const CString
& GetPerms() const { return m_sPerms
; }
81 const CString
& GetPermModes() const { return m_sPermModes
; }
82 CString
GetNickMask() const { return m_Nick
.GetNickMask(); }
83 const CString
& GetNick() const { return m_Nick
.GetNick(); }
84 const CString
& GetPass() const { return m_sPass
; }
85 CUser
* GetUser() const { return m_pUser
; }
86 bool HasNamesx() const { return m_bNamesx
; }
87 bool HasUHNames() const { return m_bUHNames
; }
88 const set
<unsigned char>& GetUserModes() const { return m_scUserModes
; }
89 // This is true if we are past raw 001
90 bool IsAuthed() const { return m_bAuthed
; }
91 bool IsCapAccepted(const CString
& sCap
) { return 1 == m_ssAcceptedCaps
.count(sCap
); }
94 // This handles NAMESX and UHNAMES in a raw 353 reply
95 void ForwardRaw353(const CString
& sLine
) const;
96 void ForwardRaw353(const CString
& sLine
, CClient
* pClient
) const;
98 void SetNick(const CString
& sNick
);
99 void ParseISupport(const CString
& sLine
);
100 // This is called when we connect and the nick we want is already taken
101 void SendAltNick(const CString
& sBadNick
);
108 CString m_sPermModes
;
109 set
<unsigned char> m_scUserModes
;
110 map
<unsigned char, EChanModeArgs
> m_mueChanModes
;
114 map
<CString
, CChan
*> m_msChans
;
115 unsigned int m_uMaxNickLen
;
116 unsigned int m_uCapPaused
;
117 SCString m_ssAcceptedCaps
;
118 SCString m_ssPendingCaps
;
120 unsigned int m_uNumCTCP
;
121 static const time_t m_uCTCPFloodTime
;
122 static const unsigned int m_uCTCPFloodCount
;
125 #endif // !_IRCSOCK_H