Anope IRC Services  Version 2.0
unreal.cpp
Go to the documentation of this file.
1 /* Unreal IRCD 3.2.x functions
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  */
11 
12 #include "module.h"
13 #include "modules/cs_mode.h"
14 #include "modules/sasl.h"
15 
16 class UnrealIRCdProto : public IRCDProto
17 {
18  public:
19  UnrealIRCdProto(Module *creator) : IRCDProto(creator, "UnrealIRCd 3.2.x")
20  {
21  DefaultPseudoclientModes = "+Soiq";
22  CanSVSNick = true;
23  CanSVSJoin = true;
24  CanSetVHost = true;
25  CanSetVIdent = true;
26  CanSNLine = true;
27  CanSQLine = true;
28  CanSZLine = true;
29  CanSVSHold = true;
30  CanSVSO = true;
31  MaxModes = 12;
32  }
33 
34  private:
35  /* SVSNOOP */
36  void SendSVSNOOP(const Server *server, bool set) anope_override
37  {
38  UplinkSocket::Message() << "SVSNOOP " << server->GetName() << " " << (set ? "+" : "-");
39  }
40 
42  {
43  if (x->IsRegex() || x->HasNickOrReal())
44  return;
45 
46  /* ZLine if we can instead */
47  if (x->GetUser() == "*")
48  {
49  cidr a(x->GetHost());
50  if (a.valid())
51  {
52  IRCD->SendSZLineDel(x);
53  return;
54  }
55  }
56 
57  UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << x->by;
58  }
59 
61  {
62  UplinkSocket::Message(source) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic;
63  }
64 
65  void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override
66  {
67  UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg;
68  }
69 
70  void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override
71  {
72  UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg;
73  }
74 
76  {
77  BotInfo *HostServ = Config->GetClient("HostServ");
78  u->RemoveMode(HostServ, "CLOAK");
79  u->RemoveMode(HostServ, "VHOST");
81  u->SetMode(HostServ, "CLOAK");
82  }
83 
85  {
86  if (x->IsRegex() || x->HasNickOrReal())
87  {
88  if (!u)
89  {
90  /* No user (this akill was just added), and contains nick and/or realname. Find users that match and ban them */
91  for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
92  if (x->manager->Check(it->second, x))
93  this->SendAkill(it->second, x);
94  return;
95  }
96 
97  const XLine *old = x;
98 
99  if (old->manager->HasEntry("*@" + u->host))
100  return;
101 
102  /* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */
103  XLine *xline = new XLine("*@" + u->host, old->by, old->expires, old->reason, old->id);
104  old->manager->AddXLine(xline);
105  x = xline;
106 
107  Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->mask << " because " << u->GetMask() << "#" << u->realname << " matches " << old->mask;
108  }
109 
110  /* ZLine if we can instead */
111  if (x->GetUser() == "*")
112  {
113  cidr a(x->GetHost());
114  if (a.valid())
115  {
116  IRCD->SendSZLine(u, x);
117  return;
118  }
119  }
120 
121  // Calculate the time left before this would expire, capping it at 2 days
122  time_t timeleft = x->expires - Anope::CurTime;
123  if (timeleft > 172800 || !x->expires)
124  timeleft = 172800;
125  UplinkSocket::Message() << "TKL + G " << x->GetUser() << " " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason();
126  }
127 
128  void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override
129  {
130  UplinkSocket::Message(source) << "SVSKILL " << user->nick << " :" << buf;
131  user->KillInternal(source, buf);
132  }
133 
134  void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override
135  {
136  UplinkSocket::Message(source) << "SVS2MODE " << u->nick <<" " << buf;
137  }
138 
140  {
141  Anope::string modes = "+" + u->GetModes();
142  UplinkSocket::Message() << "NICK " << u->nick << " 1 " << u->timestamp << " " << u->GetIdent() << " " << u->host << " " << u->server->GetName() << " 0 " << modes << " " << u->host << " * :" << u->realname;
143  }
144 
145  /* SERVER name hop descript */
146  /* Unreal 3.2 actually sends some info about itself in the descript area */
147  void SendServer(const Server *server) anope_override
148  {
149  if (!server->GetSID().empty() && server == Me)
150  UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :U0-*-" << server->GetSID() << " " << server->GetDescription();
151  else
152  UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription();
153  }
154 
155  /* JOIN */
156  void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
157  {
158  UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " :" << user->nick;
159  if (status)
160  {
161  /* First save the channel status incase uc->Status == status */
162  ChannelStatus cs = *status;
163  /* If the user is internally on the channel with flags, kill them so that
164  * the stacker will allow this.
165  */
166  ChanUserContainer *uc = c->FindUser(user);
167  if (uc != NULL)
168  uc->status.Clear();
169 
170  BotInfo *setter = BotInfo::Find(user->GetUID());
171  for (size_t i = 0; i < cs.Modes().length(); ++i)
172  c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
173 
174  if (uc != NULL)
175  uc->status = cs;
176  }
177  }
178 
179  /* unsqline
180  */
182  {
183  UplinkSocket::Message() << "UNSQLINE " << x->mask;
184  }
185 
186  /* SQLINE */
187  /*
188  ** - Unreal will translate this to TKL for us
189  **
190  */
192  {
193  UplinkSocket::Message() << "SQLINE " << x->mask << " :" << x->GetReason();
194  }
195 
196  /*
197  ** svso
198  ** parv[0] = sender prefix
199  ** parv[1] = nick
200  ** parv[2] = options
201  */
202  void SendSVSO(BotInfo *source, const Anope::string &nick, const Anope::string &flag) anope_override
203  {
204  UplinkSocket::Message(source) << "SVSO " << nick << " " << flag;
205  }
206 
207  /* Functions that use serval cmd functions */
208 
209  void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override
210  {
211  if (!vIdent.empty())
212  UplinkSocket::Message(Me) << "CHGIDENT " << u->nick << " " << vIdent;
213  if (!vhost.empty())
214  UplinkSocket::Message(Me) << "CHGHOST " << u->nick << " " << vhost;
215  }
216 
218  {
219  /*
220  NICKv2 = Nick Version 2
221  VHP = Sends hidden host
222  UMODE2 = sends UMODE2 on user modes
223  NICKIP = Sends IP on NICK
224  TOKEN = Use tokens to talk
225  SJ3 = Supports SJOIN
226  NOQUIT = No Quit
227  TKLEXT = Extended TKL we don't use it but best to have it
228  SJB64 = Base64 encoded time stamps
229  ESVID = Allows storing account names as services stamp
230  MLOCK = Supports the MLOCK server command
231  VL = Version Info
232  NS = Config->Numeric Server
233  */
234  Anope::string protoctl = "NICKv2 VHP UMODE2 NICKIP SJOIN SJOIN2 SJ3 NOQUIT TKLEXT ESVID MLOCK VL";
235  if (!Me->GetSID().empty())
236  protoctl += " VL";
237  UplinkSocket::Message() << "PROTOCTL " << protoctl;
238  UplinkSocket::Message() << "PASS :" << Config->Uplinks[Anope::CurrentUplink].password;
239  SendServer(Me);
240  }
241 
242  /* SVSHOLD - set */
243  void SendSVSHold(const Anope::string &nick, time_t t) anope_override
244  {
245  UplinkSocket::Message() << "TKL + Q H " << nick << " " << Me->GetName() << " " << Anope::CurTime + t << " " << Anope::CurTime << " :Being held for registered user";
246  }
247 
248  /* SVSHOLD - release */
250  {
251  UplinkSocket::Message() << "TKL - Q * " << nick << " " << Me->GetName();
252  }
253 
254  /* UNSGLINE */
255  /*
256  * SVSNLINE - :realname mask
257  */
259  {
260  UplinkSocket::Message() << "SVSNLINE - :" << x->mask;
261  }
262 
263  /* UNSZLINE */
265  {
266  UplinkSocket::Message() << "TKL - Z * " << x->GetHost() << " " << x->by;
267  }
268 
269  /* SZLINE */
271  {
272  // Calculate the time left before this would expire, capping it at 2 days
273  time_t timeleft = x->expires - Anope::CurTime;
274  if (timeleft > 172800 || !x->expires)
275  timeleft = 172800;
276  UplinkSocket::Message() << "TKL + Z * " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason();
277  }
278 
279  /* SGLINE */
280  /*
281  * SVSNLINE + reason_where_is_space :realname mask with spaces
282  */
284  {
285  Anope::string edited_reason = x->GetReason();
286  edited_reason = edited_reason.replace_all_cs(" ", "_");
287  UplinkSocket::Message() << "SVSNLINE + " << edited_reason << " :" << x->mask;
288  }
289 
290  /* svsjoin
291  parv[0] - sender
292  parv[1] - nick to make join
293  parv[2] - channel to join
294  parv[3] - (optional) channel key(s)
295  */
296  /* In older Unreal SVSJOIN and SVSNLINE tokens were mixed so SVSJOIN and SVSNLINE are broken
297  when coming from a none TOKEN'd server
298  */
299  void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) anope_override
300  {
301  if (!param.empty())
302  UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan << " :" << param;
303  else
304  UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan;
305  }
306 
307  void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) anope_override
308  {
309  if (!param.empty())
310  UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan << " :" << param;
311  else
312  UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan;
313  }
314 
315  void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) anope_override
316  {
317  UplinkSocket::Message(source) << "SWHOIS " << who << " :" << mask;
318  }
319 
321  {
322  UplinkSocket::Message(Me) << "EOS";
323  }
324 
326  {
327  if (nick.equals_ci("ircd") || nick.equals_ci("irc"))
328  return false;
329 
330  return IRCDProto::IsNickValid(nick);
331  }
332 
334  {
335  if (chan.find(':') != Anope::string::npos)
336  return false;
337 
338  return IRCDProto::IsChannelValid(chan);
339  }
340 
342  {
343  return mask.length() >= 4 && mask[0] == '~' && mask[2] == ':';
344  }
345 
347  {
348  if (Servers::Capab.count("ESVID") > 0)
349  IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %s", na->nc->display.c_str());
350  else
351  IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %d", u->signon);
352  }
353 
355  {
356  IRCD->SendMode(Config->GetClient("NickServ"), u, "+d 0");
357  }
358 
360  {
361  /* Unreal does not support updating a channels TS without actually joining a user,
362  * so we will join and part us now
363  */
364  BotInfo *bi = c->ci->WhoSends();
365  if (!bi)
366  ;
367  else if (c->FindUser(bi) == NULL)
368  {
369  bi->Join(c);
370  bi->Part(c);
371  }
372  else
373  {
374  bi->Part(c);
375  bi->Join(c);
376  }
377  }
378 
380  {
381  size_t p = message.target.find('!');
382  if (p == Anope::string::npos)
383  return;
384 
385  UplinkSocket::Message(BotInfo::Find(message.source)) << "SASL " << message.target.substr(0, p) << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : " " + message.ext);
386  }
387 
389  {
390  size_t p = uid.find('!');
391  if (p == Anope::string::npos)
392  return;
393  UplinkSocket::Message(Me) << "SVSLOGIN " << uid.substr(0, p) << " " << uid << " " << acc;
394  }
395 
397  {
398  if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen"))
399  return false;
400 
401  for (unsigned i = 0; i < ident.length(); ++i)
402  {
403  const char &c = ident[i];
404 
405  if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '-')
406  continue;
407 
408  if (c == '-' || c == '.' || c == '_')
409  continue;
410 
411  return false;
412  }
413 
414  return true;
415  }
416 };
417 
418 class UnrealExtBan : public ChannelModeVirtual<ChannelModeList>
419 {
420  char ext;
421 
422  public:
423  UnrealExtBan(const Anope::string &mname, const Anope::string &basename, char extban) : ChannelModeVirtual<ChannelModeList>(mname, basename)
424  , ext(extban)
425  {
426  }
427 
429  {
430  param = "~" + Anope::string(ext) + ":" + param;
432  }
433 
435  {
436  if (cm->type != MODE_LIST || param.length() < 4 || param[0] != '~' || param[1] != ext || param[2] != ':')
437  return cm;
438 
439  param = param.substr(3);
440  return this;
441  }
442 };
443 
444 namespace UnrealExtban
445 {
447  {
448  public:
449  ChannelMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
450  {
451  }
452 
453  bool Matches(User *u, const Entry *e) anope_override
454  {
455  const Anope::string &mask = e->GetMask();
456  Anope::string channel = mask.substr(3);
457 
458  ChannelMode *cm = NULL;
459  if (channel[0] != '#')
460  {
461  char modeChar = ModeManager::GetStatusChar(channel[0]);
462  channel.erase(channel.begin());
463  cm = ModeManager::FindChannelModeByChar(modeChar);
464  if (cm != NULL && cm->type != MODE_STATUS)
465  cm = NULL;
466  }
467 
468  Channel *c = Channel::Find(channel);
469  if (c != NULL)
470  {
471  ChanUserContainer *uc = c->FindUser(u);
472  if (uc != NULL)
473  if (cm == NULL || uc->status.HasMode(cm->mchar))
474  return true;
475  }
476 
477  return false;
478  }
479  };
480 
481  class EntryMatcher : public UnrealExtBan
482  {
483  public:
484  EntryMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
485  {
486  }
487 
488  bool Matches(User *u, const Entry *e) anope_override
489  {
490  const Anope::string &mask = e->GetMask();
491  Anope::string real_mask = mask.substr(3);
492 
493  return Entry(this->name, real_mask).Matches(u);
494  }
495  };
496 
498  {
499  public:
500  RealnameMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
501  {
502  }
503 
504  bool Matches(User *u, const Entry *e) anope_override
505  {
506  const Anope::string &mask = e->GetMask();
507  Anope::string real_mask = mask.substr(3);
508 
509  return Anope::Match(u->realname, real_mask);
510  }
511  };
512 
514  {
515  public:
516  RegisteredMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
517  {
518  }
519 
520  bool Matches(User *u, const Entry *e) anope_override
521  {
522  const Anope::string &mask = e->GetMask();
523  return u->HasMode("REGISTERED") && mask.equals_ci(u->nick);
524  }
525  };
526 
528  {
529  public:
530  AccountMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c)
531  {
532  }
533 
534  bool Matches(User *u, const Entry *e) anope_override
535  {
536  const Anope::string &mask = e->GetMask();
537  Anope::string real_mask = mask.substr(3);
538 
539  return u->Account() && Anope::Match(u->Account()->display, real_mask);
540  }
541  };
542 }
543 
544 class ChannelModeFlood : public ChannelModeParam
545 {
546  public:
547  ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
548 
549  /* Borrowed part of this check from UnrealIRCd */
551  {
552  if (value.empty())
553  return false;
554  try
555  {
556  Anope::string rest;
557  if (value[0] != ':' && convertTo<unsigned>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<unsigned>(rest.substr(1), rest, false) > 0 && rest.empty())
558  return true;
559  }
560  catch (const ConvertException &) { }
561 
562  /* '['<number><1 letter>[optional: '#'+1 letter],[next..]']'':'<number> */
563  size_t end_bracket = value.find(']', 1);
564  if (end_bracket == Anope::string::npos)
565  return false;
566  Anope::string xbuf = value.substr(0, end_bracket);
567  if (value[end_bracket + 1] != ':')
568  return false;
569  commasepstream args(xbuf.substr(1));
570  Anope::string arg;
571  while (args.GetToken(arg))
572  {
573  /* <number><1 letter>[optional: '#'+1 letter] */
574  size_t p = 0;
575  while (p < arg.length() && isdigit(arg[p]))
576  ++p;
577  if (p == arg.length() || !(arg[p] == 'c' || arg[p] == 'j' || arg[p] == 'k' || arg[p] == 'm' || arg[p] == 'n' || arg[p] == 't'))
578  continue; /* continue instead of break for forward compatability. */
579  try
580  {
581  int v = arg.substr(0, p).is_number_only() ? convertTo<int>(arg.substr(0, p)) : 0;
582  if (v < 1 || v > 999)
583  return false;
584  }
585  catch (const ConvertException &)
586  {
587  return false;
588  }
589  }
590 
591  return true;
592  }
593 };
594 
596 {
597  public:
599  {
600  }
601 
602  bool CanSet(User *u) const anope_override
603  {
604  return false;
605  }
606 };
607 
609 {
610  IRCDMessageCapab(Module *creator) : Message::Capab(creator, "PROTOCTL") { }
611 
612  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
613  {
614  for (unsigned i = 0; i < params.size(); ++i)
615  {
616  Anope::string capab = params[i];
617 
618  if (capab.find("CHANMODES") != Anope::string::npos)
619  {
620  Anope::string modes(capab.begin() + 10, capab.end());
621  commasepstream sep(modes);
622  Anope::string modebuf;
623 
624  sep.GetToken(modebuf);
625  for (size_t t = 0, end = modebuf.length(); t < end; ++t)
626  {
627  switch (modebuf[t])
628  {
629  case 'b':
631 
632  ModeManager::AddChannelMode(new UnrealExtban::ChannelMatcher("CHANNELBAN", "BAN", 'c'));
633  ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("JOINBAN", "BAN", 'j'));
634  ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("NONICKBAN", "BAN", 'n'));
636  ModeManager::AddChannelMode(new UnrealExtban::RealnameMatcher("REALNAMEBAN", "BAN", 'r'));
637  ModeManager::AddChannelMode(new UnrealExtban::RegisteredMatcher("REGISTEREDBAN", "BAN", 'R'));
638  ModeManager::AddChannelMode(new UnrealExtban::AccountMatcher("ACCOUNTBAN", "BAN", 'a'));
639  continue;
640  case 'e':
641  ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e'));
642  continue;
643  case 'I':
644  ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I'));
645  continue;
646  default:
647  ModeManager::AddChannelMode(new ChannelModeList("", modebuf[t]));
648  }
649  }
650 
651  sep.GetToken(modebuf);
652  for (size_t t = 0, end = modebuf.length(); t < end; ++t)
653  {
654  switch (modebuf[t])
655  {
656  case 'k':
658  continue;
659  case 'f':
661  continue;
662  case 'L':
663  ModeManager::AddChannelMode(new ChannelModeParam("REDIRECT", 'L'));
664  continue;
665  default:
666  ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t]));
667  }
668  }
669 
670  sep.GetToken(modebuf);
671  for (size_t t = 0, end = modebuf.length(); t < end; ++t)
672  {
673  switch (modebuf[t])
674  {
675  case 'l':
676  ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
677  continue;
678  case 'j':
679  ModeManager::AddChannelMode(new ChannelModeParam("JOINFLOOD", 'j', true));
680  continue;
681  default:
682  ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t], true));
683  }
684  }
685 
686  sep.GetToken(modebuf);
687  for (size_t t = 0, end = modebuf.length(); t < end; ++t)
688  {
689  switch (modebuf[t])
690  {
691  case 'p':
692  ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
693  continue;
694  case 's':
695  ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
696  continue;
697  case 'm':
698  ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
699  continue;
700  case 'n':
701  ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
702  continue;
703  case 't':
704  ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
705  continue;
706  case 'i':
707  ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
708  continue;
709  case 'r':
710  ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r'));
711  continue;
712  case 'R':
713  ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
714  continue;
715  case 'c':
716  ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
717  continue;
718  case 'O':
719  ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O'));
720  continue;
721  case 'A':
722  ModeManager::AddChannelMode(new ChannelModeOperOnly("ADMINONLY", 'A'));
723  continue;
724  case 'Q':
725  ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q'));
726  continue;
727  case 'K':
728  ModeManager::AddChannelMode(new ChannelMode("NOKNOCK", 'K'));
729  continue;
730  case 'V':
731  ModeManager::AddChannelMode(new ChannelMode("NOINVITE", 'V'));
732  continue;
733  case 'C':
734  ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C'));
735  continue;
736  case 'u':
737  ModeManager::AddChannelMode(new ChannelMode("AUDITORIUM", 'u'));
738  continue;
739  case 'z':
740  ModeManager::AddChannelMode(new ChannelMode("SSL", 'z'));
741  continue;
742  case 'N':
743  ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N'));
744  continue;
745  case 'S':
746  ModeManager::AddChannelMode(new ChannelMode("STRIPCOLOR", 'S'));
747  continue;
748  case 'M':
749  ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
750  continue;
751  case 'T':
752  ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'T'));
753  continue;
754  case 'G':
755  ModeManager::AddChannelMode(new ChannelMode("CENSOR", 'G'));
756  continue;
757  case 'Z':
759  continue;
760  default:
761  ModeManager::AddChannelMode(new ChannelMode("", modebuf[t]));
762  }
763  }
764  }
765  }
766 
767  Message::Capab::Run(source, params);
768  }
769 };
770 
772 {
773  IRCDMessageChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { }
774 
775  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
776  {
777  User *u = User::Find(params[0]);
778  if (u)
779  u->SetDisplayedHost(params[1]);
780  }
781 };
782 
784 {
785  IRCDMessageChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { }
786 
787  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
788  {
789  User *u = User::Find(params[0]);
790  if (u)
791  u->SetVIdent(params[1]);
792  }
793 };
794 
796 {
797  IRCDMessageChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { }
798 
799  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
800  {
801  User *u = User::Find(params[0]);
802  if (u)
803  u->SetRealname(params[1]);
804  }
805 };
806 
808 {
809  IRCDMessageMode(Module *creator, const Anope::string &mname) : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
810 
811  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
812  {
813  bool server_source = source.GetServer() != NULL;
814  Anope::string modes = params[1];
815  for (unsigned i = 2; i < params.size() - (server_source ? 1 : 0); ++i)
816  modes += " " + params[i];
817 
818  if (IRCD->IsChannelValid(params[0]))
819  {
820  Channel *c = Channel::Find(params[0]);
821  time_t ts = 0;
822 
823  try
824  {
825  if (server_source)
826  ts = convertTo<time_t>(params[params.size() - 1]);
827  }
828  catch (const ConvertException &) { }
829 
830  if (c)
831  c->SetModesInternal(source, modes, ts);
832  }
833  else
834  {
835  User *u = User::Find(params[0]);
836  if (u)
837  u->SetModesInternal(source, "%s", params[1].c_str());
838  }
839  }
840 };
841 
842 /* netinfo
843  * argv[0] = max global count
844  * argv[1] = time of end sync
845  * argv[2] = unreal protocol using (numeric)
846  * argv[3] = cloak-crc (> u2302)
847  * argv[4] = free(**)
848  * argv[5] = free(**)
849  * argv[6] = free(**)
850  * argv[7] = ircnet
851  */
853 {
854  IRCDMessageNetInfo(Module *creator) : IRCDMessage(creator, "NETINFO", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
855 
856  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
857  {
858  UplinkSocket::Message() << "NETINFO " << MaxUserCount << " " << Anope::CurTime << " " << convertTo<int>(params[2]) << " " << params[3] << " 0 0 0 :" << params[7];
859  }
860 };
861 
863 {
864  IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
865 
866  /*
867  ** NICK - new
868  ** source = NULL
869  ** parv[0] = nickname
870  ** parv[1] = hopcount
871  ** parv[2] = timestamp
872  ** parv[3] = username
873  ** parv[4] = hostname
874  ** parv[5] = servername
875  ** parv[6] = servicestamp
876  ** parv[7] = umodes
877  ** parv[8] = virthost, * if none
878  ** parv[9] = ip
879  ** parv[10] = info
880  **
881  ** NICK - change
882  ** source = oldnick
883  ** parv[0] = new nickname
884  ** parv[1] = hopcount
885  */
886  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
887  {
888  if (params.size() == 11)
889  {
890  Anope::string ip;
891  if (params[9] != "*")
892  {
893  Anope::string decoded_ip;
894  Anope::B64Decode(params[9], decoded_ip);
895 
896  sockaddrs ip_addr;
897  ip_addr.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str());
898  ip = ip_addr.addr();
899  }
900 
901  Anope::string vhost = params[8];
902  if (vhost.equals_cs("*"))
903  vhost.clear();
904 
905  time_t user_ts = params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime;
906 
907  Server *s = Server::Find(params[5]);
908  if (s == NULL)
909  {
910  Log(LOG_DEBUG) << "User " << params[0] << " introduced from nonexistant server " << params[5] << "?";
911  return;
912  }
913 
914  NickAlias *na = NULL;
915 
916  if (params[6] == "0")
917  ;
918  else if (params[6].is_pos_number_only())
919  {
920  if (convertTo<time_t>(params[6]) == user_ts)
921  na = NickAlias::Find(params[0]);
922  }
923  else
924  {
925  na = NickAlias::Find(params[6]);
926  }
927 
928  User::OnIntroduce(params[0], params[3], params[4], vhost, ip, s, params[10], user_ts, params[7], "", na ? *na->nc : NULL);
929  }
930  else
931  source.GetUser()->ChangeNick(params[0]);
932  }
933 };
934 
945 {
947 
948  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
949  {
950  if (!source.GetServer()->IsSynced())
951  source.GetServer()->Sync(false);
952  }
953 };
954 
956 {
958 
959  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
960  {
961  size_t p = params[1].find('!');
962  if (!SASL::sasl || p == Anope::string::npos)
963  return;
964 
965  SASL::Message m;
966  m.source = params[1];
967  m.target = params[0];
968  m.type = params[2];
969  m.data = params[3];
970  m.ext = params.size() > 4 ? params[4] : "";
971 
972  SASL::sasl->ProcessMessage(m);
973  }
974 };
975 
977 {
979 
980  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
981  {
982  source.GetServer()->SetDescription(params[0]);
983  }
984 };
985 
987 {
988  IRCDMessageSetHost(Module *creator) : IRCDMessage(creator, "SETHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
989 
990  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
991  {
992  User *u = source.GetUser();
993 
994  /* When a user sets +x we recieve the new host and then the mode change */
995  if (u->HasMode("CLOAK"))
996  u->SetDisplayedHost(params[0]);
997  else
998  u->SetCloakedHost(params[0]);
999  }
1000 };
1001 
1003 {
1004  IRCDMessageSetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
1005 
1006  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1007  {
1008  User *u = source.GetUser();
1009  u->SetVIdent(params[0]);
1010  }
1011 };
1012 
1014 {
1015  IRCDMessageSetName(Module *creator) : IRCDMessage(creator, "SETNAME", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
1016 
1017  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1018  {
1019  User *u = source.GetUser();
1020  u->SetRealname(params[0]);
1021  }
1022 };
1023 
1025 {
1027 
1028  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1029  {
1030  unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0;
1031 
1032  if (params[1].equals_cs("1"))
1033  {
1035  spacesepstream(params[2]).GetTokenRemainder(desc, 1);
1036 
1037  new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, desc);
1038  }
1039  else
1040  new Server(source.GetServer(), params[0], hops, params[2]);
1041 
1042  IRCD->SendPing(Me->GetName(), params[0]);
1043  }
1044 };
1045 
1047 {
1049 
1050  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1051  {
1053  if (params.size() >= 4)
1054  for (unsigned i = 2; i < params.size() - 1; ++i)
1055  modes += " " + params[i];
1056  if (!modes.empty())
1057  modes.erase(modes.begin());
1058 
1059  std::list<Anope::string> bans, excepts, invites;
1060  std::list<Message::Join::SJoinUser> users;
1061 
1062  spacesepstream sep(params[params.size() - 1]);
1063  Anope::string buf;
1064  while (sep.GetToken(buf))
1065  {
1066  /* Ban */
1067  if (buf[0] == '&')
1068  {
1069  buf.erase(buf.begin());
1070  bans.push_back(buf);
1071  }
1072  /* Except */
1073  else if (buf[0] == '"')
1074  {
1075  buf.erase(buf.begin());
1076  excepts.push_back(buf);
1077  }
1078  /* Invex */
1079  else if (buf[0] == '\'')
1080  {
1081  buf.erase(buf.begin());
1082  invites.push_back(buf);
1083  }
1084  else
1085  {
1087 
1088  /* Get prefixes from the nick */
1089  for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));)
1090  {
1091  sju.first.AddMode(ch);
1092  buf.erase(buf.begin());
1093  }
1094 
1095  sju.second = User::Find(buf);
1096  if (!sju.second)
1097  {
1098  Log(LOG_DEBUG) << "SJOIN for nonexistant user " << buf << " on " << params[1];
1099  continue;
1100  }
1101 
1102  users.push_back(sju);
1103  }
1104  }
1105 
1106  time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime;
1107  Message::Join::SJoin(source, params[1], ts, modes, users);
1108 
1109  if (!bans.empty() || !excepts.empty() || !invites.empty())
1110  {
1111  Channel *c = Channel::Find(params[1]);
1112 
1113  if (!c || c->creation_time != ts)
1114  return;
1115 
1117  *except = ModeManager::FindChannelModeByName("EXCEPT"),
1118  *invex = ModeManager::FindChannelModeByName("INVITEOVERRIDE");
1119 
1120  if (ban)
1121  for (std::list<Anope::string>::iterator it = bans.begin(), it_end = bans.end(); it != it_end; ++it)
1122  c->SetModeInternal(source, ban, *it);
1123  if (except)
1124  for (std::list<Anope::string>::iterator it = excepts.begin(), it_end = excepts.end(); it != it_end; ++it)
1125  c->SetModeInternal(source, except, *it);
1126  if (invex)
1127  for (std::list<Anope::string>::iterator it = invites.begin(), it_end = invites.end(); it != it_end; ++it)
1128  c->SetModeInternal(source, invex, *it);
1129  }
1130  }
1131 };
1132 
1134 {
1135  IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { }
1136 
1137  /*
1138  ** source = sender prefix
1139  ** parv[0] = channel name
1140  ** parv[1] = topic nickname
1141  ** parv[2] = topic time
1142  ** parv[3] = topic text
1143  */
1144  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1145  {
1146  Channel *c = Channel::Find(params[0]);
1147  if (c)
1148  c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
1149  }
1150 };
1151 
1152 
1154 {
1155  IRCDMessageUmode2(Module *creator) : IRCDMessage(creator, "UMODE2", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
1156 
1157  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1158  {
1159  source.GetUser()->SetModesInternal(source, "%s", params[0].c_str());
1160  }
1161 };
1162 
1163 class ProtoUnreal : public Module
1164 {
1166 
1167  /* Core message handlers */
1185 
1186  /* Our message handlers */
1204 
1206 
1207  void AddModes()
1208  {
1209  ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0));
1210  ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
1211  ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2));
1212  /* Unreal sends +q as * and +a as ~ */
1213  ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '~', 3));
1214  ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '*', 4));
1215 
1216  /* Add user modes */
1217  ModeManager::AddUserMode(new UserModeOperOnly("SERV_ADMIN", 'A'));
1218  ModeManager::AddUserMode(new UserMode("BOT", 'B'));
1219  ModeManager::AddUserMode(new UserModeOperOnly("CO_ADMIN", 'C'));
1220  ModeManager::AddUserMode(new UserMode("CENSOR", 'G'));
1221  ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H'));
1222  ModeManager::AddUserMode(new UserMode("HIDEIDLE", 'I'));
1223  ModeManager::AddUserMode(new UserModeOperOnly("NETADMIN", 'N'));
1224  ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
1225  ModeManager::AddUserMode(new UserModeOperOnly("PROTECTED", 'S'));
1226  ModeManager::AddUserMode(new UserMode("NOCTCP", 'T'));
1227  ModeManager::AddUserMode(new UserMode("WEBTV", 'V'));
1228  ModeManager::AddUserMode(new UserModeOperOnly("WHOIS", 'W'));
1229  ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a'));
1230  ModeManager::AddUserMode(new UserMode("DEAF", 'd'));
1231  ModeManager::AddUserMode(new UserModeOperOnly("GLOBOPS", 'g'));
1232  ModeManager::AddUserMode(new UserModeOperOnly("HELPOP", 'h'));
1233  ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
1234  ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
1235  ModeManager::AddUserMode(new UserMode("PRIV", 'p'));
1236  ModeManager::AddUserMode(new UserModeOperOnly("GOD", 'q'));
1237  ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r'));
1238  ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
1239  ModeManager::AddUserMode(new UserModeNoone("VHOST", 't'));
1240  ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
1241  ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
1242  ModeManager::AddUserMode(new UserModeNoone("SSL", 'z'));
1243  }
1244 
1245  public:
1246  ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
1247  ircd_proto(this),
1248  message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this),
1249  message_kill(this), message_motd(this), message_notice(this), message_part(this), message_ping(this),
1250  message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this),
1251  message_version(this), message_whois(this),
1252 
1253  message_capab(this), message_chghost(this), message_chgident(this), message_chgname(this), message_mode(this, "MODE"),
1254  message_svsmode(this, "SVSMODE"), message_svs2mode(this, "SVS2MODE"), message_netinfo(this), message_nick(this), message_pong(this),
1255  message_sasl(this), message_sdesc(this), message_sethost(this), message_setident(this), message_setname(this), message_server(this),
1256  message_sjoin(this), message_topic(this), message_umode2(this)
1257  {
1258 
1259  this->AddModes();
1260 
1262  }
1263 
1265  {
1266  use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock");
1267  }
1268 
1270  {
1272  if (Servers::Capab.count("ESVID") == 0)
1273  IRCD->SendLogout(u);
1274  }
1275 
1277  {
1278  if (!c->ci)
1279  return;
1280 
1281  ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks");
1282  if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0 && modelocks)
1283  {
1284  Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "");
1285  UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes;
1286  }
1287  }
1288 
1290  {
1291  ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
1292  if (!ci->c || !use_server_side_mlock || !modelocks || !Servers::Capab.count("MLOCK"))
1293  return;
1294  Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "");
1295  UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes;
1296  }
1297 
1299  {
1300  if (!ci->c || !use_server_side_mlock || !Servers::Capab.count("MLOCK"))
1301  return;
1302  UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " :";
1303  }
1304 
1306  {
1307  ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
1309  if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
1310  {
1311  Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar;
1312  UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes;
1313  }
1314 
1315  return EVENT_CONTINUE;
1316  }
1317 
1319  {
1320  ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks");
1322  if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
1323  {
1324  Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, "");
1325  UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes;
1326  }
1327 
1328  return EVENT_CONTINUE;
1329  }
1330 };
1331 
Serialize::Reference< NickCore > nc
Definition: account.h:47
Definition: bots.h:24
bool HasMode(const Anope::string &name) const
Definition: users.cpp:513
void SendAkill(User *u, XLine *x) anope_override
Definition: unreal.cpp:84
IRCDMessageTopic(Module *creator)
Definition: unreal.cpp:1135
IRCDMessageMode message_svs2mode
Definition: unreal.cpp:1191
bool CanSZLine
Definition: protocol.h:61
Anope::string target
Definition: sasl.h:14
RegisteredMatcher(const Anope::string &mname, const Anope::string &mbase, char c)
Definition: unreal.cpp:516
static NickAlias * Find(const Anope::string &nick)
Definition: nickalias.cpp:121
ProtoUnreal(const Anope::string &modname, const Anope::string &creator)
Definition: unreal.cpp:1246
Definition: servers.h:42
void SetCloakedHost(const Anope::string &newhost)
Definition: users.cpp:213
bool equals_cs(const char *_str) const
Definition: anope.h:74
IRCDMessageChgName(Module *creator)
Definition: unreal.cpp:797
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:959
IRCDMessageSetName(Module *creator)
Definition: unreal.cpp:1015
IRCDMessageServer(Module *creator)
Definition: unreal.cpp:1026
Anope::string reason
Definition: xline.h:29
bool CanSNLine
Definition: protocol.h:55
Message::Time message_time
Definition: unreal.cpp:1182
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:799
IRCDMessageUmode2(Module *creator)
Definition: unreal.cpp:1155
void SendSVSLogin(const Anope::string &uid, const Anope::string &acc) anope_override
Definition: unreal.cpp:388
Anope::string mask
Definition: xline.h:24
void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override
Definition: unreal.cpp:209
static ChannelMode * FindChannelModeByName(const Anope::string &name)
Definition: modes.cpp:542
IRCDMessageSJoin(Module *creator)
Definition: unreal.cpp:1048
Anope::string source
Definition: sasl.h:13
bool Matches(User *u, bool full=false) const
Definition: modes.cpp:830
XLineManager * manager
Definition: xline.h:30
Definition: hashcomp.h:84
UnrealExtBan(const Anope::string &mname, const Anope::string &basename, char extban)
Definition: unreal.cpp:423
void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) anope_override
Definition: unreal.cpp:307
void clear()
Definition: anope.h:187
void RemoveModeInternal(const MessageSource &setter, UserMode *um)
Definition: users.cpp:554
void Join(Channel *c, ChannelStatus *status=NULL)
Definition: bots.cpp:193
void SetMode(BotInfo *bi, UserMode *um, const Anope::string &param="")
Definition: users.cpp:573
EntryMatcher(const Anope::string &mname, const Anope::string &mbase, char c)
Definition: unreal.cpp:484
bool IsIdentValid(const Anope::string &ident) anope_override
Definition: unreal.cpp:396
void SendAkillDel(const XLine *x) anope_override
Definition: unreal.cpp:41
Anope::string desc
Definition: access.cpp:23
ChannelMatcher(const Anope::string &mname, const Anope::string &mbase, char c)
Definition: unreal.cpp:449
void SendTopic(const MessageSource &source, Channel *c) anope_override
Definition: unreal.cpp:60
IRCDMessageSJoin message_sjoin
Definition: unreal.cpp:1201
void OnDelChan(ChannelInfo *ci) anope_override
Definition: unreal.cpp:1298
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:1028
void OnChanRegistered(ChannelInfo *ci) anope_override
Definition: unreal.cpp:1289
EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override
Definition: unreal.cpp:1305
CoreExport std::set< Anope::string > Capab
Definition: servers.cpp:29
IRCDMessageSetHost message_sethost
Definition: unreal.cpp:1197
Message::Privmsg message_privmsg
Definition: unreal.cpp:1178
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:886
Message::Ping message_ping
Definition: unreal.cpp:1177
Message::Version message_version
Definition: unreal.cpp:1183
Anope::string addr() const
Definition: sockets.cpp:73
static bool SetPriority(Module *mod, Implementation i, Priority s, Module **modules=NULL, size_t sz=1)
const Anope::string & GetSID() const
Definition: servers.cpp:203
void SendSASLMessage(const SASL::Message &message) anope_override
Definition: unreal.cpp:379
void SendSVSHoldDel(const Anope::string &nick) anope_override
Definition: unreal.cpp:249
Message::Away message_away
Definition: unreal.cpp:1168
Anope::string data
Definition: sasl.h:16
virtual void SendLogout(User *u)=0
void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) anope_override
Definition: unreal.cpp:315
IRCDMessageChgHost(Module *creator)
Definition: unreal.cpp:773
time_t creation_time
Definition: channels.h:48
static User * OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc)
Definition: users.cpp:116
Capab(Module *creator, const Anope::string &mname="CAPAB")
Definition: messages.h:32
Definition: users.h:34
IRCDMessageChgIdent(Module *creator)
Definition: unreal.cpp:785
UnrealIRCdProto(Module *creator)
Definition: unreal.cpp:19
void SendConnect() anope_override
Definition: unreal.cpp:217
CoreExport unsigned MaxUserCount
Definition: users.cpp:31
void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override
Definition: unreal.cpp:128
Anope::string DefaultPseudoclientModes
Definition: protocol.h:47
void SendSGLine(User *, const XLine *x) anope_override
Definition: unreal.cpp:283
IRCDMessagePong(Module *creator)
Definition: unreal.cpp:946
IRCDMessageUmode2 message_umode2
Definition: unreal.cpp:1203
void SendSQLine(User *, const XLine *x) anope_override
Definition: unreal.cpp:191
IRCDMessageNetInfo message_netinfo
Definition: unreal.cpp:1192
IRCDMessageMode message_mode
Definition: unreal.cpp:1191
Message::Invite message_invite
Definition: unreal.cpp:1170
RealnameMatcher(const Anope::string &mname, const Anope::string &mbase, char c)
Definition: unreal.cpp:500
bool CanSetVHost
Definition: protocol.h:53
bool equals_ci(const char *_str) const
Definition: anope.h:78
void SendSZLine(User *, const XLine *x) anope_override
Definition: unreal.cpp:270
Definition: sockets.h:87
bool HasMode(char c) const
Definition: modes.cpp:81
static UserMode * FindUserModeByName(const Anope::string &name)
Definition: modes.cpp:550
CoreExport time_t CurTime
Definition: main.cpp:41
bool Matches(User *u, const Entry *e) anope_override
Definition: unreal.cpp:453
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:1144
Message::Whois message_whois
Definition: unreal.cpp:1184
IRCDMessageSetName message_setname
Definition: unreal.cpp:1199
iterator erase(const iterator &i)
Definition: anope.h:155
Message::Stats message_stats
Definition: unreal.cpp:1181
string substr(size_type pos=0, size_type n=npos) const
Definition: anope.h:277
IRCDMessageServer message_server
Definition: unreal.cpp:1200
void SendVhostDel(User *u) anope_override
Definition: unreal.cpp:75
virtual Anope::string GetMLockAsString(bool complete) const =0
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:775
bool CanSetVIdent
Definition: protocol.h:53
size_type length() const
Definition: anope.h:131
bool IsNickValid(const Anope::string &nick) anope_override
Definition: unreal.cpp:325
Message::Error message_error
Definition: unreal.cpp:1169
bool Matches(User *u, const Entry *e) anope_override
Definition: unreal.cpp:488
ChannelMode * Unwrap(ChannelMode *cm, Anope::string &param) anope_override
Definition: unreal.cpp:434
ChannelModeUnrealSSL(const Anope::string &n, char c)
Definition: unreal.cpp:598
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:948
bool CanSQLine
Definition: protocol.h:57
ModeType type
Definition: modes.h:49
Definition: Config.cs:26
bool CanSVSNick
Definition: protocol.h:49
void SetRealname(const Anope::string &realname)
Definition: users.cpp:279
void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override
Definition: unreal.cpp:134
unsigned MaxModes
Definition: protocol.h:73
CoreExport bool Match(const string &str, const string &mask, bool case_sensitive=false, bool use_regex=false)
Definition: misc.cpp:407
static char GetStatusChar(char symbol)
Definition: modes.cpp:558
ChannelMode * Wrap(Anope::string &param) anope_override
Definition: unreal.cpp:428
static bool AddUserMode(UserMode *um)
Definition: modes.cpp:391
bool IsExtbanValid(const Anope::string &mask) anope_override
Definition: unreal.cpp:341
void AddModes()
Definition: unreal.cpp:1207
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: messages.cpp:31
static const size_type npos
Definition: anope.h:44
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:787
void SetFlag(IRCDMessageFlag f)
Definition: protocol.h:282
static ServiceReference< SASL::Service > sasl("SASL::Service","sasl")
void ntop(int type, const void *src)
Definition: sockets.cpp:156
string replace_all_cs(const string &_orig, const string &_repl) const
Definition: anope.h:229
void SendSQLineDel(const XLine *x) anope_override
Definition: unreal.cpp:181
virtual void SendPing(const Anope::string &servname, const Anope::string &who)
Definition: protocol.cpp:262
void SendSGLineDel(const XLine *x) anope_override
Definition: unreal.cpp:258
void SendSZLineDel(const XLine *x) anope_override
Definition: unreal.cpp:264
IRCDMessageCapab(Module *creator)
Definition: unreal.cpp:610
CoreExport void B64Decode(const string &src, string &target)
Definition: base64.cpp:123
bool CanSVSO
Definition: protocol.h:65
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:1017
void ChangeTopicInternal(const Anope::string &user, const Anope::string &newtopic, time_t ts=Anope::CurTime)
Definition: channels.cpp:786
Definition: modes.h:68
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:1157
void SendSVSNOOP(const Server *server, bool set) anope_override
Definition: unreal.cpp:36
virtual bool IsNickValid(const Anope::string &)
Definition: protocol.cpp:349
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:980
IRCDMessageChgName message_chgname
Definition: unreal.cpp:1190
virtual void SendSZLineDel(const XLine *)
Definition: protocol.h:117
Message::Part message_part
Definition: unreal.cpp:1176
void SetVIdent(const Anope::string &ident)
Definition: users.cpp:238
char mchar
Definition: modes.h:47
static ChannelMode * FindChannelModeByChar(char mode)
Definition: modes.cpp:524
bool IsChannelValid(const Anope::string &chan) anope_override
Definition: unreal.cpp:333
Anope::string by
Definition: xline.h:26
void Part(Channel *c, const Anope::string &reason="")
Definition: bots.cpp:211
time_t expires
Definition: xline.h:28
IRCDMessageTopic message_topic
Definition: unreal.cpp:1202
IRCDMessageSetIdent(Module *creator)
Definition: unreal.cpp:1004
void SendClientIntroduction(User *u) anope_override
Definition: unreal.cpp:139
IRCDMessageChgHost message_chghost
Definition: unreal.cpp:1188
static Anope::map< std::pair< bool, Anope::string > > modes
Definition: cs_mode.cpp:745
#define anope_override
Definition: services.h:56
bool empty() const
Definition: anope.h:126
Anope::string id
Definition: xline.h:31
IRCDMessageSASL message_sasl
Definition: unreal.cpp:1195
void SendChannel(Channel *c) anope_override
Definition: unreal.cpp:359
void SetModeInternal(MessageSource &source, ChannelMode *cm, const Anope::string &param="", bool enforce_mlock=true)
Definition: channels.cpp:251
void SetModesInternal(MessageSource &source, const Anope::string &mode, time_t ts=0, bool enforce_mlock=true)
Definition: channels.cpp:595
ChannelModeFlood(char modeChar, bool minusNoArg)
Definition: unreal.cpp:547
IRCDMessageSetHost(Module *creator)
Definition: unreal.cpp:988
static Server * Find(const Anope::string &name, bool name_only=false)
Definition: servers.cpp:337
Anope::string ext
Definition: sasl.h:17
IRCDMessageMode message_svsmode
Definition: unreal.cpp:1191
CoreExport IRCDProto * IRCD
Definition: protocol.cpp:23
std::basic_string< char, ci_char_traits, std::allocator< char > > string
Definition: hashcomp.h:133
IRCDMessageSDesc message_sdesc
Definition: unreal.cpp:1196
EventReturn
Definition: modules.h:129
#define MODULE_INIT(x)
Definition: modules.h:45
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override
Definition: unreal.cpp:65
IRCDMessageSDesc(Module *creator)
Definition: unreal.cpp:978
ChanUserContainer * FindUser(User *u) const
Definition: channels.cpp:173
Message::Kill message_kill
Definition: unreal.cpp:1173
Anope::string type
Definition: sasl.h:15
void SetDisplayedHost(const Anope::string &host)
Definition: users.cpp:189
ChannelMode * Wrap(Anope::string &param) anope_override
Definition: modes.cpp:216
virtual void SendSZLine(User *u, const XLine *)
Definition: protocol.h:116
bool Matches(User *u, const Entry *e) anope_override
Definition: unreal.cpp:504
void SendLogout(User *u) anope_override
Definition: unreal.cpp:354
bool CanSVSHold
Definition: protocol.h:63
ChannelStatus status
Definition: channels.h:28
void SendSVSHold(const Anope::string &nick, time_t t) anope_override
Definition: unreal.cpp:243
Message::MOTD message_motd
Definition: unreal.cpp:1174
IRCDMessageMode(Module *creator, const Anope::string &mname)
Definition: unreal.cpp:809
IRCDMessageNetInfo(Module *creator)
Definition: unreal.cpp:854
CoreExport int CurrentUplink
Definition: main.cpp:43
IRCDMessageSetIdent message_setident
Definition: unreal.cpp:1198
Definition: unreal.cpp:481
static void ProcessModes()
Definition: modes.cpp:633
std::pair< ChannelStatus, User * > SJoinUser
Definition: messages.h:57
IRCDMessageCapab message_capab
Definition: unreal.cpp:1187
XLine * HasEntry(const Anope::string &mask)
Definition: xline.cpp:391
virtual bool IsChannelValid(const Anope::string &)
Definition: protocol.cpp:372
static User * Find(const Anope::string &name, bool nick_only=false)
Definition: users.cpp:815
bool Matches(User *u, const Entry *e) anope_override
Definition: unreal.cpp:520
void Clear()
Definition: modes.cpp:91
const Anope::string & GetName() const
Definition: servers.cpp:175
static bool AddChannelMode(ChannelMode *cm)
Definition: modes.cpp:418
void SendLogin(User *u, NickAlias *na) anope_override
Definition: unreal.cpp:346
bool use_server_side_mlock
Definition: unreal.cpp:1205
iterator end()
Definition: anope.h:284
void SendServer(const Server *server) anope_override
Definition: unreal.cpp:147
static Channel * Find(const Anope::string &name)
Definition: channels.cpp:920
Definition: xline.h:18
IRCDMessageNick message_nick
Definition: unreal.cpp:1193
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:811
void OnChannelSync(Channel *c) anope_override
Definition: unreal.cpp:1276
void SendSVSO(BotInfo *source, const Anope::string &nick, const Anope::string &flag) anope_override
Definition: unreal.cpp:202
Message::Kick message_kick
Definition: unreal.cpp:1172
CoreExport Server * Me
Definition: servers.cpp:24
CoreExport user_map UserListByNick
Definition: users.cpp:28
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
Definition: unreal.cpp:156
void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) anope_override
Definition: unreal.cpp:299
const Anope::string & Modes() const
Definition: modes.cpp:96
void SetModesInternal(const MessageSource &source, const char *umodes,...)
Definition: users.cpp:645
Message::Join message_join
Definition: unreal.cpp:1171
IRCDMessageSASL(Module *creator)
Definition: unreal.cpp:957
const char * c_str() const
Definition: anope.h:117
Definition: logger.h:53
Message::SQuit message_squit
Definition: unreal.cpp:1180
void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override
Definition: unreal.cpp:70
bool CanSVSJoin
Definition: protocol.h:51
IRCDMessagePong message_pong
Definition: unreal.cpp:1194
static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list< SJoinUser > &users)
Definition: messages.cpp:97
virtual void SendMode(const MessageSource &source, const Channel *dest, const char *fmt,...)
Definition: protocol.cpp:188
bool CanSet(User *u) const anope_override
Definition: unreal.cpp:602
Message::Notice message_notice
Definition: unreal.cpp:1175
Definition: modes.h:388
void OnUserNickChange(User *u, const Anope::string &) anope_override
Definition: unreal.cpp:1269
void AddXLine(XLine *x)
Definition: xline.cpp:286
AccountMatcher(const Anope::string &mname, const Anope::string &mbase, char c)
Definition: unreal.cpp:530
Anope::string name
Definition: modes.h:43
Message::Quit message_quit
Definition: unreal.cpp:1179
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:1006
iterator begin()
Definition: anope.h:282
bool is_number_only() const
Definition: anope.h:217
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:990
bool IsValid(Anope::string &value) const anope_override
Definition: unreal.cpp:550
size_type find(const string &_str, size_type pos=0) const
Definition: anope.h:192
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:1050
static BotInfo * Find(const Anope::string &nick, bool nick_only=false)
Definition: bots.cpp:249
IRCDMessageNick(Module *creator)
Definition: unreal.cpp:864
IRCDMessageChgIdent message_chgident
Definition: unreal.cpp:1189
EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override
Definition: unreal.cpp:1318
void SendEOB() anope_override
Definition: unreal.cpp:320
void OnReload(Configuration::Conf *conf) anope_override
Definition: unreal.cpp:1264
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:856
UnrealIRCdProto ircd_proto
Definition: unreal.cpp:1165
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: unreal.cpp:612
bool Matches(User *u, const Entry *e) anope_override
Definition: unreal.cpp:534
bool GetTokenRemainder(Anope::string &token, int num)
Definition: hashcomp.cpp:143