23 namespace ClientProtocol
52 void InitCommand(
unsigned int number)
54 snprintf(numericstr,
sizeof(numericstr),
"%03u", number);
58 void InitFromNumeric(const ::Numeric::Numeric& numeric)
60 InitCommand(numeric.GetNumeric());
61 for (std::vector<std::string>::const_iterator i = numeric.GetParams().begin(); i != numeric.GetParams().end(); ++i)
71 : ClientProtocol::
Message(NULL, (num.GetServer() ? num.GetServer()->GetName() : ServerInstance->Config->ServerName))
84 Numeric(const ::Numeric::Numeric& num,
const std::string& target)
85 : ClientProtocol::
Message(NULL, (num.GetServer() ? num.GetServer()->GetName() : ServerInstance->Config->ServerName))
95 : ClientProtocol::
Message(NULL, ServerInstance->Config->ServerName)
113 : ClientProtocol::
Message(
"JOIN")
122 : ClientProtocol::
Message(
"JOIN", Memb->user)
132 : ClientProtocol::
Message(
"JOIN", sourcestrref, Memb->user)
162 : ClientProtocol::
Message(
"PART", memb->user)
181 : ClientProtocol::
Message(
"KICK", source)
199 : ClientProtocol::
Message(
"QUIT", source)
216 : ClientProtocol::
Message(
"NICK", source)
229 Modes::ChangeList::List::const_iterator beginit;
230 Modes::ChangeList::List::const_iterator lastit;
238 static std::string ToModeLetters(
const Modes::ChangeList::List& list, std::string::size_type maxlinelen, Modes::ChangeList::List::const_iterator beginit, Modes::ChangeList::List::const_iterator& lastit)
241 std::string::size_type paramlength = 0;
242 char output_pm =
'\0';
244 Modes::ChangeList::List::const_iterator i;
245 for (i = beginit; i != list.end(); ++i)
249 const char needed_pm = (item.adding ?
'+' :
'-');
250 if (needed_pm != output_pm)
252 output_pm = needed_pm;
253 ret.push_back(output_pm);
256 if (!item.param.empty())
257 paramlength += item.param.length() + 1;
258 if (ret.length() + 1 + paramlength > maxlinelen)
261 const char c = *ret.rbegin();
262 if ((c ==
'+') || (c ==
'-'))
263 ret.erase(ret.size()-1);
276 void PushModeParams()
278 for (Modes::ChangeList::List::const_iterator i = beginit; i != lastit; ++i)
281 if (!item.param.empty())
294 Modes::ChangeList::List::const_iterator dummy;
295 return ToModeLetters(changelist.
getlist(), UINT_MAX, changelist.
getlist().begin(), dummy);
306 : ClientProtocol::
Message(
"MODE", source)
307 , chantarget(Chantarget)
308 , usertarget(Usertarget)
323 : ClientProtocol::
Message(
"MODE", source)
324 , chantarget(Chantarget)
325 , usertarget(Usertarget)
326 , beginit(changelist.getlist().begin())
337 : ClientProtocol::
Message(
"MODE", ServerInstance->FakeClient)
352 chantarget = Chantarget;
353 usertarget = Usertarget;
354 beginit = changelist.
getlist().begin();
369 Modes::ChangeList::List::const_iterator
GetEndIterator()
const {
return lastit; }
399 : ClientProtocol::
Message(
"TOPIC", source)
410 void PushTargetChan(
char status,
const Channel* targetchan)
414 std::string rawtarget(1, status);
415 rawtarget.append(targetchan->
name);
424 void PushTargetUser(
const User* targetuser)
443 return ((mt == MSG_PRIVMSG) ?
"PRIVMSG" :
"NOTICE");
452 Privmsg(
User* source,
const std::string& target,
const std::string& text, MessageType mt = MSG_PRIVMSG)
466 Privmsg(
User* source,
const Channel* targetchan,
const std::string& text, MessageType mt = MSG_PRIVMSG,
char status = 0)
469 PushTargetChan(status, targetchan);
479 Privmsg(
User* source,
const User* targetuser,
const std::string& text, MessageType mt = MSG_PRIVMSG)
482 PushTargetUser(targetuser);
493 Privmsg(
const std::string& source,
const std::string& target,
const std::string& text, MessageType mt = MSG_PRIVMSG,
char status = 0)
498 std::string rawtarget(1, status);
499 rawtarget.append(target);
516 Privmsg(
const std::string& source,
const Channel* targetchan,
const std::string& text, MessageType mt = MSG_PRIVMSG,
char status = 0)
519 PushTargetChan(status, targetchan);
529 Privmsg(
const std::string& source,
const User* targetuser,
const std::string& text, MessageType mt = MSG_PRIVMSG)
532 PushTargetUser(targetuser);
542 Privmsg(
NoCopy,
User* source,
const std::string& target,
const std::string& text, MessageType mt = MSG_PRIVMSG)
559 PushTargetChan(status, targetchan);
572 PushTargetUser(targetuser);
582 Privmsg(
NoCopy,
const std::string& source,
const std::string& target,
const std::string& text, MessageType mt = MSG_PRIVMSG)
596 Privmsg(
NoCopy,
const std::string& source,
const Channel* targetchan,
const std::string& text, MessageType mt = MSG_PRIVMSG,
char status = 0)
599 PushTargetChan(status, targetchan);
609 Privmsg(
NoCopy,
const std::string& source,
const User* targetuser,
const std::string& text, MessageType mt = MSG_PRIVMSG)
612 PushTargetUser(targetuser);
628 : ClientProtocol::
Message(
"INVITE", source)
644 : ClientProtocol::
Message(
"PING")
652 Ping(
const std::string& cookie)
653 : ClientProtocol::
Message(
"PING")
668 Pong(
const std::string& cookie,
const std::string& server =
"")
669 : ClientProtocol::
Message(
"PONG", ServerInstance->Config->ServerName)
687 : ClientProtocol::
Message(
"ERROR")
Privmsg(const std::string &source, const std::string &target, const std::string &text, MessageType mt=MSG_PRIVMSG, char status=0)
Definition: clientprotocolmsg.h:493
Privmsg(const std::string &source, const User *targetuser, const std::string &text, MessageType mt=MSG_PRIVMSG)
Definition: clientprotocolmsg.h:529
const List & getlist() const
Definition: modechange.h:119
Definition: clientprotocolmsg.h:225
Join()
Definition: clientprotocolmsg.h:112
Definition: modechange.h:52
std::string name
Definition: channels.h:88
Privmsg(User *source, const User *targetuser, const std::string &text, MessageType mt=MSG_PRIVMSG)
Definition: clientprotocolmsg.h:479
Definition: clientprotocolmsg.h:155
Definition: clientprotocolmsg.h:408
Nick(User *source, const std::string &newnick)
Definition: clientprotocolmsg.h:215
Channel * GetChanTarget() const
Definition: clientprotocolmsg.h:386
Join(Membership *Memb)
Definition: clientprotocolmsg.h:121
void ClearParams()
Definition: clientprotocol.h:421
Privmsg(NoCopy, User *source, const User *targetuser, const std::string &text, MessageType mt=MSG_PRIVMSG)
Definition: clientprotocolmsg.h:569
Numeric(unsigned int num)
Definition: clientprotocolmsg.h:94
void SetParams(Channel *Chantarget, User *Usertarget, const Modes::ChangeList &changelist)
Definition: clientprotocolmsg.h:348
const std::string & GetStrTarget() const
Definition: clientprotocolmsg.h:376
Topic(User *source, const Channel *chan, const std::string &newtopic)
Definition: clientprotocolmsg.h:398
Definition: modechange.h:31
Definition: clientprotocolmsg.h:391
Mode(User *source, Channel *Chantarget, User *Usertarget, const Modes::ChangeList &changelist, Modes::ChangeList::List::const_iterator beginiter)
Definition: clientprotocolmsg.h:305
Modes::ChangeList::List::const_iterator GetEndIterator() const
Definition: clientprotocolmsg.h:369
Ping(const std::string &cookie)
Definition: clientprotocolmsg.h:652
Invite(User *source, User *target, Channel *chan)
Definition: clientprotocolmsg.h:627
void SetParams(Membership *Memb)
Definition: clientprotocolmsg.h:140
Definition: clientprotocolmsg.h:192
Definition: clientprotocolmsg.h:681
NoCopy
Definition: clientprotocolmsg.h:435
Mode()
Definition: clientprotocolmsg.h:336
Quit(User *source, const std::string &reason)
Definition: clientprotocolmsg.h:198
Privmsg(NoCopy, User *source, const std::string &target, const std::string &text, MessageType mt=MSG_PRIVMSG)
Definition: clientprotocolmsg.h:542
Mode(User *source, Channel *Chantarget, User *Usertarget, const Modes::ChangeList &changelist)
Definition: clientprotocolmsg.h:322
Definition: clientprotocolmsg.h:173
Definition: clientprotocolmsg.h:662
char GetModeChar() const
Definition: mode.h:243
std::string ServerName
Definition: configreader.h:328
static const char * CommandStrFromMsgType(MessageType mt)
Definition: clientprotocolmsg.h:441
Numeric(const ::Numeric::Numeric &num, const std::string &target)
Definition: clientprotocolmsg.h:84
Modes::ChangeList::List::const_iterator GetBeginIterator() const
Definition: clientprotocolmsg.h:364
Definition: channels.h:40
static std::string ToModeLetters(const Modes::ChangeList &changelist)
Definition: clientprotocolmsg.h:291
Kick(User *source, Membership *memb, const std::string &reason)
Definition: clientprotocolmsg.h:180
void PushParam(const char *str)
Definition: clientprotocol.h:355
void SetCommand(const char *cmd)
Definition: clientprotocol.h:296
Definition: clientprotocolmsg.h:209
std::string nick
Definition: users.h:317
Privmsg(NoCopy, const std::string &source, const Channel *targetchan, const std::string &text, MessageType mt=MSG_PRIVMSG, char status=0)
Definition: clientprotocolmsg.h:596
User *const user
Definition: membership.h:44
Channel *const chan
Definition: membership.h:48
Ping()
Definition: clientprotocolmsg.h:643
Privmsg(const std::string &source, const Channel *targetchan, const std::string &text, MessageType mt=MSG_PRIVMSG, char status=0)
Definition: clientprotocolmsg.h:516
Definition: clientprotocolmsg.h:638
void PushParamRef(const std::string &str)
Definition: clientprotocol.h:366
Privmsg(User *source, const std::string &target, const std::string &text, MessageType mt=MSG_PRIVMSG)
Definition: clientprotocolmsg.h:452
Definition: clientprotocol.h:181
Membership * GetMember() const
Definition: clientprotocolmsg.h:149
ServerConfig * Config
Definition: inspircd.h:273
Privmsg(NoCopy, const std::string &source, const std::string &target, const std::string &text, MessageType mt=MSG_PRIVMSG)
Definition: clientprotocolmsg.h:582
User * GetUserTarget() const
Definition: clientprotocolmsg.h:381
Pong(const std::string &cookie, const std::string &server="")
Definition: clientprotocolmsg.h:668
Definition: clientprotocolmsg.h:620
Privmsg(NoCopy, User *source, const Channel *targetchan, const std::string &text, MessageType mt=MSG_PRIVMSG, char status=0)
Definition: clientprotocolmsg.h:556
Join(Membership *Memb, const std::string &sourcestrref)
Definition: clientprotocolmsg.h:131
Definition: clientprotocolmsg.h:48
Definition: membership.h:35
Part(Membership *memb, const std::string &reason)
Definition: clientprotocolmsg.h:161
Error(const std::string &text)
Definition: clientprotocolmsg.h:686
Privmsg(NoCopy, const std::string &source, const User *targetuser, const std::string &text, MessageType mt=MSG_PRIVMSG)
Definition: clientprotocolmsg.h:609
unsigned int registered
Definition: users.h:360
Privmsg(User *source, const Channel *targetchan, const std::string &text, MessageType mt=MSG_PRIVMSG, char status=0)
Definition: clientprotocolmsg.h:466
Numeric(const ::Numeric::Numeric &num, User *user)
Definition: clientprotocolmsg.h:70
Definition: clientprotocolmsg.h:105