Anope IRC Services  Version 2.0
inspircd12.cpp
Go to the documentation of this file.
1 /* inspircd 1.2 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/sasl.h"
14 
15 struct SASLUser
16 {
19  time_t created;
20 };
21 
22 static std::list<SASLUser> saslusers;
23 
25 
27 {
28  public:
29  ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
30 
32  {
33  try
34  {
35  Anope::string rest;
36  if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty())
37  return true;
38  }
39  catch (const ConvertException &) { }
40 
41  return false;
42  }
43 };
44 
45 class InspIRCd12Proto : public IRCDProto
46 {
47  private:
48  void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override
49  {
50  IRCDProto::SendSVSKillInternal(source, user, buf);
51  user->KillInternal(source, buf);
52  }
53 
54  void SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent)
55  {
56  if (!Servers::Capab.count("CHGIDENT"))
57  Log() << "CHGIDENT not loaded!";
58  else
59  UplinkSocket::Message(Me) << "CHGIDENT " << nick << " " << vIdent;
60  }
61 
62  void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost)
63  {
64  if (!Servers::Capab.count("CHGHOST"))
65  Log() << "CHGHOST not loaded!";
66  else
67  UplinkSocket::Message(Me) << "CHGHOST " << nick << " " << vhost;
68  }
69 
70  void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason)
71  {
72  UplinkSocket::Message(Me) << "ADDLINE " << xtype << " " << mask << " " << addedby << " " << Anope::CurTime << " " << duration << " :" << reason;
73  }
74 
75  void SendDelLine(const Anope::string &xtype, const Anope::string &mask)
76  {
77  UplinkSocket::Message(Me) << "DELLINE " << xtype << " " << mask;
78  }
79 
80  public:
81  InspIRCd12Proto(Module *creator) : IRCDProto(creator, "InspIRCd 1.2")
82  {
84  CanSVSNick = true;
85  CanSVSJoin = true;
86  CanSetVHost = true;
87  CanSetVIdent = true;
88  CanSQLine = true;
89  CanSZLine = true;
90  CanSVSHold = true;
91  CanCertFP = true;
92  RequiresID = true;
93  MaxModes = 20;
94  }
95 
96  void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override
97  {
98  UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg;
99  }
100 
101  void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override
102  {
103  UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg;
104  }
105 
107  {
108  /* InspIRCd may support regex bans */
109  if (x->IsRegex() && Servers::Capab.count("RLINE"))
110  {
111  Anope::string mask = x->mask;
112  size_t h = x->mask.find('#');
113  if (h != Anope::string::npos)
114  mask = mask.replace(h, 1, ' ');
115  SendDelLine("R", mask);
116  return;
117  }
118  else if (x->IsRegex() || x->HasNickOrReal())
119  return;
120 
121  /* ZLine if we can instead */
122  if (x->GetUser() == "*")
123  {
124  cidr addr(x->GetHost());
125  if (addr.valid())
126  {
127  IRCD->SendSZLineDel(x);
128  return;
129  }
130  }
131 
132  SendDelLine("G", x->GetUser() + "@" + x->GetHost());
133  }
134 
136  {
137  if (Servers::Capab.count("SVSTOPIC"))
138  {
139  UplinkSocket::Message(c->ci->WhoSends()) << "SVSTOPIC " << c->name << " " << c->topic_ts << " " << c->topic_setter << " :" << c->topic;
140  }
141  else
142  {
143  /* If the last time a topic was set is after the TS we want for this topic we must bump this topic's timestamp to now */
144  time_t ts = c->topic_ts;
145  if (c->topic_time > ts)
146  ts = Anope::CurTime;
147  /* But don't modify c->topic_ts, it should remain set to the real TS we want as ci->last_topic_time pulls from it */
148  UplinkSocket::Message(source) << "FTOPIC " << c->name << " " << ts << " " << c->topic_setter << " :" << c->topic;
149  }
150  }
151 
153  {
154  if (u->HasMode("CLOAK"))
155  this->SendChgHostInternal(u->nick, u->chost);
156  else
157  this->SendChgHostInternal(u->nick, u->host);
158 
159  if (Servers::Capab.count("CHGIDENT") && u->GetIdent() != u->GetVIdent())
160  this->SendChgIdentInternal(u->nick, u->GetIdent());
161  }
162 
164  {
165  // Calculate the time left before this would expire, capping it at 2 days
166  time_t timeleft = x->expires - Anope::CurTime;
167  if (timeleft > 172800 || !x->expires)
168  timeleft = 172800;
169 
170  /* InspIRCd may support regex bans, if they do we can send this and forget about it */
171  if (x->IsRegex() && Servers::Capab.count("RLINE"))
172  {
173  Anope::string mask = x->mask;
174  size_t h = x->mask.find('#');
175  if (h != Anope::string::npos)
176  mask = mask.replace(h, 1, ' ');
177  SendAddLine("R", mask, timeleft, x->by, x->GetReason());
178  return;
179  }
180  else if (x->IsRegex() || x->HasNickOrReal())
181  {
182  if (!u)
183  {
184  /* No user (this akill was just added), and contains nick and/or realname. Find users that match and ban them */
185  for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
186  if (x->manager->Check(it->second, x))
187  this->SendAkill(it->second, x);
188  return;
189  }
190 
191  const XLine *old = x;
192 
193  if (old->manager->HasEntry("*@" + u->host))
194  return;
195 
196  /* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */
197  x = new XLine("*@" + u->host, old->by, old->expires, old->reason, old->id);
198  old->manager->AddXLine(x);
199 
200  Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->mask << " because " << u->GetMask() << "#" << u->realname << " matches " << old->mask;
201  }
202 
203  /* ZLine if we can instead */
204  if (x->GetUser() == "*")
205  {
206  cidr addr(x->GetHost());
207  if (addr.valid())
208  {
209  IRCD->SendSZLine(u, x);
210  return;
211  }
212  }
213 
214  SendAddLine("G", x->GetUser() + "@" + x->GetHost(), timeleft, x->by, x->GetReason());
215  }
216 
217  void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) anope_override
218  {
219  UplinkSocket::Message() << "PUSH " << dest << " ::" << Me->GetName() << " " << numeric << " " << dest << " " << buf;
220  }
221 
222  void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override
223  {
224  UplinkSocket::Message(source) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf;
225  }
226 
228  {
229  Anope::string modes = "+" + u->GetModes();
230  UplinkSocket::Message(Me) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->timestamp << " " << modes << " :" << u->realname;
231  }
232 
233  /* SERVER services-dev.chatspike.net password 0 :Description here */
234  void SendServer(const Server *server) anope_override
235  {
236  /* if rsquit is set then we are waiting on a squit */
237  if (rsquit_id.empty() && rsquit_server.empty())
238  UplinkSocket::Message() << "SERVER " << server->GetName() << " " << Config->Uplinks[Anope::CurrentUplink].password << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription();
239  }
240 
241  void SendSquit(Server *s, const Anope::string &message) anope_override
242  {
243  if (s != Me)
244  {
245  rsquit_id = s->GetSID();
246  rsquit_server = s->GetName();
247  UplinkSocket::Message() << "RSQUIT " << s->GetName() << " :" << message;
248  }
249  else
250  UplinkSocket::Message() << "SQUIT " << s->GetName() << " :" << message;
251  }
252 
253  /* JOIN */
254  void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
255  {
256  UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :," << user->GetUID();
257  /* Note that we can send this with the FJOIN but choose not to
258  * because the mode stacker will handle this and probably will
259  * merge these modes with +nrt and other mlocked modes
260  */
261  if (status)
262  {
263  /* First save the channel status incase uc->Status == status */
264  ChannelStatus cs = *status;
265  /* If the user is internally on the channel with flags, kill them so that
266  * the stacker will allow this.
267  */
268  ChanUserContainer *uc = c->FindUser(user);
269  if (uc != NULL)
270  uc->status.Clear();
271 
272  BotInfo *setter = BotInfo::Find(user->GetUID());
273  for (size_t i = 0; i < cs.Modes().length(); ++i)
274  c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
275 
276  if (uc != NULL)
277  uc->status = cs;
278  }
279  }
280 
281  /* UNSQLINE */
283  {
284  SendDelLine("Q", x->mask);
285  }
286 
287  /* SQLINE */
289  {
290  // Calculate the time left before this would expire, capping it at 2 days
291  time_t timeleft = x->expires - Anope::CurTime;
292  if (timeleft > 172800 || !x->expires)
293  timeleft = 172800;
294  SendAddLine("Q", x->mask, timeleft, x->by, x->GetReason());
295  }
296 
297  void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override
298  {
299  if (!vIdent.empty())
300  this->SendChgIdentInternal(u->nick, vIdent);
301  if (!vhost.empty())
302  this->SendChgHostInternal(u->nick, vhost);
303  }
304 
306  {
307  SendServer(Me);
308  }
309 
310  /* SVSHOLD - set */
311  void SendSVSHold(const Anope::string &nick, time_t t) anope_override
312  {
313  UplinkSocket::Message(Config->GetClient("NickServ")) << "SVSHOLD " << nick << " " << t << " :Being held for registered user";
314  }
315 
316  /* SVSHOLD - release */
318  {
319  UplinkSocket::Message(Config->GetClient("NickServ")) << "SVSHOLD " << nick;
320  }
321 
322  /* UNSZLINE */
324  {
325  SendDelLine("Z", x->GetHost());
326  }
327 
328  /* SZLINE */
330  {
331  // Calculate the time left before this would expire, capping it at 2 days
332  time_t timeleft = x->expires - Anope::CurTime;
333  if (timeleft > 172800 || !x->expires)
334  timeleft = 172800;
335  SendAddLine("Z", x->GetHost(), timeleft, x->by, x->GetReason());
336  }
337 
338  void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) anope_override
339  {
340  UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan;
341  }
342 
343  void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) anope_override
344  {
345  if (!param.empty())
346  UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param;
347  else
348  UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan;
349  }
350 
351  void SendSWhois(const MessageSource &, const Anope::string &who, const Anope::string &mask) anope_override
352  {
353  User *u = User::Find(who);
354 
355  UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " swhois :" << mask;
356  }
357 
359  {
360  UplinkSocket::Message(Me) << "BURST " << Anope::CurTime;
362  UplinkSocket::Message(Me) << "VERSION :Anope-" << Anope::Version() << " " << Me->GetName() << " :" << IRCD->GetProtocolName() << " - (" << (enc ? enc->name : "none") << ") -- " << Anope::VersionBuildString();
363  }
364 
366  {
367  UplinkSocket::Message(Me) << "ENDBURST";
368  }
369 
371  {
372  if (Servers::Capab.count("GLOBOPS"))
373  UplinkSocket::Message(source) << "SNONOTICE g :" << buf;
374  else
375  UplinkSocket::Message(source) << "SNONOTICE A :" << buf;
376  }
377 
379  {
380  /* InspIRCd uses an account to bypass chmode +R, not umode +r, so we can't send this here */
381  if (na->nc->HasExt("UNCONFIRMED"))
382  return;
383 
384  UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << na->nc->display;
385  }
386 
388  {
389  UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :";
390  }
391 
393  {
394  UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :";
395  }
396 
398  {
399  }
400 
402  {
403  UplinkSocket::Message(Me) << "ENCAP " << message.target.substr(0, 3) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext));
404  }
405 
407  {
408  UplinkSocket::Message(Me) << "METADATA " << uid << " accountname :" << acc;
409 
410  SASLUser su;
411  su.uid = uid;
412  su.acc = acc;
413  su.created = Anope::CurTime;
414 
415  for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();)
416  {
417  SASLUser &u = *it;
418 
419  if (u.created + 30 < Anope::CurTime || u.uid == uid)
420  it = saslusers.erase(it);
421  else
422  ++it;
423  }
424 
425  saslusers.push_back(su);
426  }
427 
429  {
430  return mask.length() >= 3 && mask[1] == ':';
431  }
432 
434  {
435  if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen"))
436  return false;
437 
438  for (unsigned i = 0; i < ident.length(); ++i)
439  {
440  const char &c = ident[i];
441 
442  if (c >= 'A' && c <= '}')
443  continue;
444 
445  if ((c >= '0' && c <= '9') || c == '-' || c == '.')
446  continue;
447 
448  return false;
449  }
450 
451  return true;
452  }
453 };
454 
456 {
457  public:
458  InspIRCdExtBan(const Anope::string &mname, char modeChar) : ChannelModeList(mname, modeChar) { }
459 
460  bool Matches(User *u, const Entry *e) anope_override
461  {
462  const Anope::string &mask = e->GetMask();
463 
464  if (mask.find("m:") == 0 || mask.find("N:") == 0)
465  {
466  Anope::string real_mask = mask.substr(2);
467 
468  Entry en(this->name, real_mask);
469  if (en.Matches(u))
470  return true;
471  }
472  else if (mask.find("j:") == 0)
473  {
474  Anope::string real_mask = mask.substr(2);
475 
476  Channel *c = Channel::Find(real_mask);
477  if (c != NULL && c->FindUser(u) != NULL)
478  return true;
479  }
480  else if (mask.find("M:") == 0 || mask.find("R:") == 0)
481  {
482  Anope::string real_mask = mask.substr(2);
483 
484  if (u->IsIdentified() && real_mask.equals_ci(u->Account()->display))
485  return true;
486  }
487  else if (mask.find("r:") == 0)
488  {
489  Anope::string real_mask = mask.substr(2);
490 
491  if (Anope::Match(u->realname, real_mask))
492  return true;
493  }
494  else if (mask.find("s:") == 0)
495  {
496  Anope::string real_mask = mask.substr(2);
497 
498  if (Anope::Match(u->server->GetName(), real_mask))
499  return true;
500  }
501 
502  return false;
503  }
504 };
505 
507 {
508  IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
509 
510  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
511  {
512  if (params[0].equals_cs("START"))
513  {
514  /* reset CAPAB */
515  Servers::Capab.clear();
516  Servers::Capab.insert("NOQUIT");
517  IRCD->CanSVSHold = false;
518  }
519  else if (params[0].equals_cs("MODULES") && params.size() > 1)
520  {
521  if (params[1].find("m_globops.so") != Anope::string::npos)
522  Servers::Capab.insert("GLOBOPS");
523  if (params[1].find("m_services_account.so") != Anope::string::npos)
524  Servers::Capab.insert("SERVICES");
525  if (params[1].find("m_svshold.so") != Anope::string::npos)
526  IRCD->CanSVSHold = true;
527  if (params[1].find("m_chghost.so") != Anope::string::npos)
528  Servers::Capab.insert("CHGHOST");
529  if (params[1].find("m_chgident.so") != Anope::string::npos)
530  Servers::Capab.insert("CHGIDENT");
531  if (params[1].find("m_hidechans.so") != Anope::string::npos)
532  Servers::Capab.insert("HIDECHANS");
533  if (params[1].find("m_servprotect.so") != Anope::string::npos)
535  if (params[1].find("m_rline.so") != Anope::string::npos)
536  Servers::Capab.insert("RLINE");
537  }
538  else if (params[0].equals_cs("CAPABILITIES") && params.size() > 1)
539  {
540  spacesepstream ssep(params[1]);
541  Anope::string capab;
542  while (ssep.GetToken(capab))
543  {
544  if (capab.find("CHANMODES") != Anope::string::npos)
545  {
546  Anope::string modes(capab.begin() + 10, capab.end());
547  commasepstream sep(modes);
548  Anope::string modebuf;
549 
550  sep.GetToken(modebuf);
551  for (size_t t = 0, end = modebuf.length(); t < end; ++t)
552  {
553  switch (modebuf[t])
554  {
555  case 'b':
557  continue;
558  case 'e':
559  ModeManager::AddChannelMode(new InspIRCdExtBan("EXCEPT", 'e'));
560  continue;
561  case 'I':
562  ModeManager::AddChannelMode(new InspIRCdExtBan("INVITEOVERRIDE", 'I'));
563  continue;
564  /* InspIRCd sends q and a here if they have no prefixes */
565  case 'q':
566  ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '@', 4));
567  continue;
568  case 'a':
569  ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT" , 'a', '@', 3));
570  continue;
571  default:
572  ModeManager::AddChannelMode(new ChannelModeList("", modebuf[t]));
573  }
574  }
575 
576  sep.GetToken(modebuf);
577  for (size_t t = 0, end = modebuf.length(); t < end; ++t)
578  {
579  switch (modebuf[t])
580  {
581  case 'k':
583  continue;
584  default:
585  ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t]));
586  }
587  }
588 
589  sep.GetToken(modebuf);
590  for (size_t t = 0, end = modebuf.length(); t < end; ++t)
591  {
592  switch (modebuf[t])
593  {
594  case 'F':
595  ModeManager::AddChannelMode(new ChannelModeParam("NICKFLOOD", 'F', true));
596  continue;
597  case 'J':
598  ModeManager::AddChannelMode(new ChannelModeParam("NOREJOIN", 'J', true));
599  continue;
600  case 'L':
601  ModeManager::AddChannelMode(new ChannelModeParam("REDIRECT", 'L', true));
602  continue;
603  case 'f':
605  continue;
606  case 'j':
607  ModeManager::AddChannelMode(new ChannelModeParam("JOINFLOOD", 'j', true));
608  continue;
609  case 'l':
610  ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
611  continue;
612  default:
613  ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t], true));
614  }
615  }
616 
617  sep.GetToken(modebuf);
618  for (size_t t = 0, end = modebuf.length(); t < end; ++t)
619  {
620  switch (modebuf[t])
621  {
622  case 'A':
623  ModeManager::AddChannelMode(new ChannelMode("ALLINVITE", 'A'));
624  continue;
625  case 'B':
626  ModeManager::AddChannelMode(new ChannelMode("BLOCKCAPS", 'B'));
627  continue;
628  case 'C':
629  ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C'));
630  continue;
631  case 'D':
632  ModeManager::AddChannelMode(new ChannelMode("DELAYEDJOIN", 'D'));
633  continue;
634  case 'G':
635  ModeManager::AddChannelMode(new ChannelMode("CENSOR", 'G'));
636  continue;
637  case 'K':
638  ModeManager::AddChannelMode(new ChannelMode("NOKNOCK", 'K'));
639  continue;
640  case 'M':
641  ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
642  continue;
643  case 'N':
644  ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N'));
645  continue;
646  case 'O':
647  ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O'));
648  continue;
649  case 'P':
650  ModeManager::AddChannelMode(new ChannelMode("PERM", 'P'));
651  continue;
652  case 'Q':
653  ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q'));
654  continue;
655  case 'R':
656  ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
657  continue;
658  case 'S':
659  ModeManager::AddChannelMode(new ChannelMode("STRIPCOLOR", 'S'));
660  continue;
661  case 'T':
662  ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'T'));
663  continue;
664  case 'c':
665  ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
666  continue;
667  case 'i':
668  ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
669  continue;
670  case 'm':
671  ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
672  continue;
673  case 'n':
674  ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
675  continue;
676  case 'p':
677  ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
678  continue;
679  case 'r':
680  ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r'));
681  continue;
682  case 's':
683  ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
684  continue;
685  case 't':
686  ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
687  continue;
688  case 'u':
689  ModeManager::AddChannelMode(new ChannelMode("AUDITORIUM", 'u'));
690  continue;
691  case 'z':
692  ModeManager::AddChannelMode(new ChannelMode("SSL", 'z'));
693  continue;
694  default:
695  ModeManager::AddChannelMode(new ChannelMode("", modebuf[t]));
696  }
697  }
698  }
699  else if (capab.find("USERMODES") != Anope::string::npos)
700  {
701  Anope::string modes(capab.begin() + 10, capab.end());
702  commasepstream sep(modes);
703  Anope::string modebuf;
704 
705  while (sep.GetToken(modebuf))
706  {
707  for (size_t t = 0, end = modebuf.length(); t < end; ++t)
708  {
709  switch (modebuf[t])
710  {
711  case 'h':
712  ModeManager::AddUserMode(new UserModeOperOnly("HELPOP", 'h'));
713  continue;
714  case 'B':
715  ModeManager::AddUserMode(new UserMode("BOT", 'B'));
716  continue;
717  case 'G':
718  ModeManager::AddUserMode(new UserMode("CENSOR", 'G'));
719  continue;
720  case 'H':
721  ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H'));
722  continue;
723  case 'I':
724  ModeManager::AddUserMode(new UserMode("PRIV", 'I'));
725  continue;
726  case 'Q':
727  ModeManager::AddUserMode(new UserModeOperOnly("HIDDEN", 'Q'));
728  continue;
729  case 'R':
730  ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
731  continue;
732  case 'S':
733  ModeManager::AddUserMode(new UserMode("STRIPCOLOR", 'S'));
734  continue;
735  case 'W':
736  ModeManager::AddUserMode(new UserMode("WHOIS", 'W'));
737  continue;
738  case 'c':
739  ModeManager::AddUserMode(new UserMode("COMMONCHANS", 'c'));
740  continue;
741  case 'g':
742  ModeManager::AddUserMode(new UserMode("CALLERID", 'g'));
743  continue;
744  case 'i':
745  ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
746  continue;
747  case 'k':
748  ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'k'));
749  continue;
750  case 'o':
751  ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
752  continue;
753  case 'r':
754  ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r'));
755  continue;
756  case 'w':
757  ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
758  continue;
759  case 'x':
760  ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
761  continue;
762  case 'd':
763  ModeManager::AddUserMode(new UserMode("DEAF", 'd'));
764  continue;
765  default:
766  ModeManager::AddUserMode(new UserMode("", modebuf[t]));
767  }
768  }
769  }
770  }
771  else if (capab.find("PREFIX=(") != Anope::string::npos)
772  {
773  Anope::string modes(capab.begin() + 8, capab.begin() + capab.find(')'));
774  Anope::string chars(capab.begin() + capab.find(')') + 1, capab.end());
775  unsigned short level = modes.length() - 1;
776 
777  for (size_t t = 0, end = modes.length(); t < end; ++t)
778  {
779  switch (modes[t])
780  {
781  case 'q':
782  ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', chars[t], level--));
783  continue;
784  case 'a':
785  ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', chars[t], level--));
786  continue;
787  case 'o':
788  ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', chars[t], level--));
789  continue;
790  case 'h':
791  ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', chars[t], level--));
792  continue;
793  case 'v':
794  ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', chars[t], level--));
795  continue;
796  default:
797  ModeManager::AddChannelMode(new ChannelModeStatus("", modes[t], chars[t], level--));
798  }
799  }
800 
802  }
803  else if (capab.find("MAXMODES=") != Anope::string::npos)
804  {
805  Anope::string maxmodes(capab.begin() + 9, capab.end());
806  IRCD->MaxModes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3;
807  }
808  }
809  }
810  else if (params[0].equals_cs("END"))
811  {
812  if (!Servers::Capab.count("GLOBOPS"))
813  {
814  UplinkSocket::Message() << "ERROR :m_globops is not loaded. This is required by Anope";
815  Anope::QuitReason = "Remote server does not have the m_globops module loaded, and this is required.";
816  Anope::Quitting = true;
817  return;
818  }
819  if (!Servers::Capab.count("SERVICES"))
820  {
821  UplinkSocket::Message() << "ERROR :m_services_account.so is not loaded. This is required by Anope";
822  Anope::QuitReason = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
823  Anope::Quitting = true;
824  return;
825  }
826  if (!Servers::Capab.count("HIDECHANS"))
827  {
828  UplinkSocket::Message() << "ERROR :m_hidechans.so is not loaded. This is required by Anope";
829  Anope::QuitReason = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
830  Anope::Quitting = true;
831  return;
832  }
833  if (!IRCD->CanSVSHold)
834  Log() << "SVSHOLD missing, Usage disabled until module is loaded.";
835  if (!Servers::Capab.count("CHGHOST"))
836  Log() << "CHGHOST missing, Usage disabled until module is loaded.";
837  if (!Servers::Capab.count("CHGIDENT"))
838  Log() << "CHGIDENT missing, Usage disabled until module is loaded.";
839  }
840 
841  Message::Capab::Run(source, params);
842  }
843 };
844 
846 {
847  IRCDMessageChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { }
848 
849  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
850  {
851  User *u = User::Find(params[0]);
852  if (u)
853  u->SetIdent(params[1]);
854  }
855 };
856 
858 {
860 
861  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
862  {
863  source.GetUser()->SetRealname(params[0]);
864  }
865 };
866 
868 {
869  IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
870 
871  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
872  {
873  if (Anope::Match(Me->GetSID(), params[0]) == false)
874  return;
875 
876  if (SASL::sasl && params[1] == "SASL" && params.size() >= 6)
877  {
878  SASL::Message m;
879  m.source = params[2];
880  m.target = params[3];
881  m.type = params[4];
882  m.data = params[5];
883  m.ext = params.size() > 6 ? params[6] : "";
884 
885  SASL::sasl->ProcessMessage(m);
886  }
887  }
888 };
889 
891 {
892  IRCDMessageEndburst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
893 
894  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
895  {
896  Server *s = source.GetServer();
897 
898  Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName();
899 
900  s->Sync(true);
901  }
902 };
903 
905 {
907 
908  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
909  {
910  source.GetUser()->SetDisplayedHost(params[0]);
911  }
912 };
913 
915 {
917 
918  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
919  {
921  if (params.size() >= 3)
922  {
923  for (unsigned i = 2; i < params.size() - 1; ++i)
924  modes += " " + params[i];
925  if (!modes.empty())
926  modes.erase(modes.begin());
927  }
928 
929  std::list<Message::Join::SJoinUser> users;
930 
931  spacesepstream sep(params[params.size() - 1]);
932  Anope::string buf;
933  while (sep.GetToken(buf))
934  {
936 
937  /* Loop through prefixes and find modes for them */
938  for (char c; (c = buf[0]) != ',' && c;)
939  {
940  buf.erase(buf.begin());
941  sju.first.AddMode(c);
942  }
943  /* Erase the , */
944  if (!buf.empty())
945  buf.erase(buf.begin());
946 
947  sju.second = User::Find(buf);
948  if (!sju.second)
949  {
950  Log(LOG_DEBUG) << "FJOIN for nonexistant user " << buf << " on " << params[0];
951  continue;
952  }
953 
954  users.push_back(sju);
955  }
956 
957  time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime;
958  Message::Join::SJoin(source, params[0], ts, modes, users);
959  }
960 };
961 
963 {
964  IRCDMessageFMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
965 
966  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
967  {
968  /* :source FMODE #test 12345678 +nto foo */
969 
970  Anope::string modes = params[2];
971  for (unsigned n = 3; n < params.size(); ++n)
972  modes += " " + params[n];
973 
974  Channel *c = Channel::Find(params[0]);
975  time_t ts;
976 
977  try
978  {
979  ts = convertTo<time_t>(params[1]);
980  }
981  catch (const ConvertException &)
982  {
983  ts = 0;
984  }
985 
986  if (c)
987  c->SetModesInternal(source, modes, ts);
988  }
989 };
990 
992 {
993  IRCDMessageFTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { }
994 
995  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
996  {
997  /* :source FTOPIC channel topicts setby :topic */
998 
999  Channel *c = Channel::Find(params[0]);
1000  if (c)
1001  c->ChangeTopicInternal(params[2], params[3], Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime);
1002  }
1003 };
1004 
1006 {
1007  IRCDMessageIdle(Module *creator) : IRCDMessage(creator, "IDLE", 1) { }
1008 
1009  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1010  {
1011  BotInfo *bi = BotInfo::Find(params[0]);
1012  if (bi)
1013  UplinkSocket::Message(bi) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " " << (Anope::CurTime - bi->lastmsg);
1014  else
1015  {
1016  User *u = User::Find(params[0]);
1017  if (u && u->server == Me)
1018  UplinkSocket::Message(u) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " 0";
1019  }
1020  }
1021 };
1022 
1023 /*
1024  * source = numeric of the sending server
1025  * params[0] = uuid
1026  * params[1] = metadata name
1027  * params[2] = data
1028  */
1030 {
1032 
1033  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1034  {
1035  if (isdigit(params[0][0]))
1036  {
1037  if (params[1].equals_cs("accountname"))
1038  {
1039  User *u = User::Find(params[0]);
1040  NickCore *nc = NickCore::Find(params[2]);
1041  if (u && nc)
1042  u->Login(nc);
1043  }
1044 
1045  /*
1046  * possible incoming ssl_cert messages:
1047  * Received: :409 METADATA 409AAAAAA ssl_cert :vTrSe c38070ce96e41cc144ed6590a68d45a6 <...> <...>
1048  * Received: :409 METADATA 409AAAAAC ssl_cert :vTrSE Could not get peer certificate: error:00000000:lib(0):func(0):reason(0)
1049  */
1050  else if (params[1].equals_cs("ssl_cert"))
1051  {
1052  User *u = User::Find(params[0]);
1053  if (!u)
1054  return;
1055  u->Extend<bool>("ssl");
1056  Anope::string data = params[2].c_str();
1057  size_t pos1 = data.find(' ') + 1;
1058  size_t pos2 = data.find(' ', pos1);
1059  if ((pos2 - pos1) >= 32) // inspircd supports md5 and sha1 fingerprint hashes -> size 32 or 40 bytes.
1060  {
1061  u->fingerprint = data.substr(pos1, pos2 - pos1);
1062  }
1063  FOREACH_MOD(OnFingerprint, (u));
1064  }
1065  }
1066  else if (params[0][0] == '#')
1067  {
1068  }
1069  else if (params[0] == "*")
1070  {
1071  // Wed Oct 3 15:40:27 2012: S[14] O :20D METADATA * modules :-m_svstopic.so
1072 
1073  if (params[1].equals_cs("modules") && !params[2].empty())
1074  {
1075  // only interested when it comes from our uplink
1076  Server* server = source.GetServer();
1077  if (!server || server->GetUplink() != Me)
1078  return;
1079 
1080  bool plus = (params[2][0] == '+');
1081  if (!plus && params[2][0] != '-')
1082  return;
1083 
1084  bool required = false;
1085  Anope::string capab, module = params[2].substr(1);
1086 
1087  if (module.equals_cs("m_services_account.so"))
1088  required = true;
1089  else if (module.equals_cs("m_hidechans.so"))
1090  required = true;
1091  else if (module.equals_cs("m_chghost.so"))
1092  capab = "CHGHOST";
1093  else if (module.equals_cs("m_chgident.so"))
1094  capab = "CHGIDENT";
1095  else if (module.equals_cs("m_svshold.so"))
1096  capab = "SVSHOLD";
1097  else if (module.equals_cs("m_rline.so"))
1098  capab = "RLINE";
1099  else if (module.equals_cs("m_topiclock.so"))
1100  capab = "TOPICLOCK";
1101  else
1102  return;
1103 
1104  if (required)
1105  {
1106  if (!plus)
1107  Log() << "Warning: InspIRCd unloaded module " << module << ", Anope won't function correctly without it";
1108  }
1109  else
1110  {
1111  if (plus)
1112  Servers::Capab.insert(capab);
1113  else
1114  Servers::Capab.erase(capab);
1115 
1116  Log() << "InspIRCd " << (plus ? "loaded" : "unloaded") << " module " << module << ", adjusted functionality";
1117  }
1118 
1119  }
1120  }
1121  }
1122 };
1123 
1125 {
1126  IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
1127 
1128  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1129  {
1130  if (IRCD->IsChannelValid(params[0]))
1131  {
1132  Channel *c = Channel::Find(params[0]);
1133 
1134  Anope::string modes = params[1];
1135  for (unsigned n = 2; n < params.size(); ++n)
1136  modes += " " + params[n];
1137 
1138  if (c)
1139  c->SetModesInternal(source, modes);
1140  }
1141  else
1142  {
1143  /* InspIRCd lets opers change another
1144  users modes, we have to kludge this
1145  as it slightly breaks RFC1459
1146  */
1147  User *u = source.GetUser();
1148  // This can happen with server-origin modes.
1149  if (!u)
1150  u = User::Find(params[0]);
1151  // if it's still null, drop it like fire.
1152  // most likely situation was that server introduced a nick which we subsequently akilled
1153  if (u)
1154  u->SetModesInternal(source, "%s", params[1].c_str());
1155  }
1156  }
1157 };
1158 
1160 {
1162 
1163  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1164  {
1165  source.GetUser()->ChangeNick(params[0]);
1166  }
1167 };
1168 
1170 {
1172 
1173  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1174  {
1175  /* opertype is equivalent to mode +o because servers
1176  dont do this directly */
1177  User *u = source.GetUser();
1178  if (!u->HasMode("OPER"))
1179  u->SetModesInternal(source, "+o");
1180  }
1181 };
1182 
1184 {
1185  IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
1186 
1187  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1188  {
1189  Server *s = Server::Find(params[0]);
1190  const Anope::string &reason = params.size() > 1 ? params[1] : "";
1191  if (!s)
1192  return;
1193 
1194  UplinkSocket::Message(Me) << "SQUIT " << s->GetSID() << " :" << reason;
1195  s->Delete(s->GetName() + " " + s->GetUplink()->GetName());
1196  }
1197 };
1198 
1200 {
1201  IRCDMessageSetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
1202 
1203  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1204  {
1205  source.GetUser()->SetIdent(params[0]);
1206  }
1207 };
1208 
1210 {
1212 
1213  /*
1214  * [Nov 04 00:08:46.308435 2009] debug: Received: SERVER irc.inspircd.com pass 0 964 :Testnet Central!
1215  * 0: name
1216  * 1: pass
1217  * 2: hops
1218  * 3: numeric
1219  * 4: desc
1220  */
1221  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1222  {
1223  unsigned int hops = Anope::string(params[2]).is_pos_number_only() ? convertTo<unsigned>(params[2]) : 0;
1224  new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[4], params[3]);
1225  }
1226 };
1227 
1229 {
1230  IRCDMessageSQuit(Module *creator) : Message::SQuit(creator) { }
1231 
1232  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1233  {
1234  if (params[0] == rsquit_id || params[0] == rsquit_server)
1235  {
1236  /* squit for a recently squit server, introduce the juped server now */
1237  Server *s = Server::Find(rsquit_server);
1238 
1239  rsquit_id.clear();
1240  rsquit_server.clear();
1241 
1242  if (s && s->IsJuped())
1243  IRCD->SendServer(s);
1244  }
1245  else
1246  Message::SQuit::Run(source, params);
1247  }
1248 };
1249 
1251 {
1252  IRCDMessageTime(Module *creator) : IRCDMessage(creator, "TIME", 2) { }
1253 
1254  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1255  {
1256  UplinkSocket::Message(Me) << "TIME " << source.GetSource() << " " << params[1] << " " << Anope::CurTime;
1257  }
1258 };
1259 
1260 struct IRCDMessageUID : IRCDMessage
1261 {
1263 
1264  /*
1265  * [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org>
1266  * 0: uid
1267  * 1: ts
1268  * 2: nick
1269  * 3: host
1270  * 4: dhost
1271  * 5: ident
1272  * 6: ip
1273  * 7: signon
1274  * 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname!
1275  * last: realname
1276  */
1277  void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override
1278  {
1279  time_t ts = convertTo<time_t>(params[1]);
1280 
1281  Anope::string modes = params[8];
1282  for (unsigned i = 9; i < params.size() - 1; ++i)
1283  modes += " " + params[i];
1284 
1285  NickAlias *na = NULL;
1286  if (SASL::sasl)
1287  for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();)
1288  {
1289  SASLUser &u = *it;
1290 
1291  if (u.created + 30 < Anope::CurTime)
1292  it = saslusers.erase(it);
1293  else if (u.uid == params[0])
1294  {
1295  na = NickAlias::Find(u.acc);
1296  it = saslusers.erase(it);
1297  }
1298  else
1299  ++it;
1300  }
1301 
1302  User *u = User::OnIntroduce(params[2], params[5], params[3], params[4], params[6], source.GetServer(), params[params.size() - 1], ts, modes, params[0], na ? *na->nc : NULL);
1303  if (u)
1304  u->signon = convertTo<time_t>(params[7]);
1305  }
1306 };
1307 
1308 class ProtoInspIRCd12 : public Module
1309 {
1312 
1313  /* Core message handlers */
1328 
1329  /* Our message handlers */
1350 
1351  public:
1352  ProtoInspIRCd12(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
1353  ircd_proto(this), ssl(this, "ssl"),
1354  message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this), message_kill(this),
1355  message_motd(this), message_notice(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this),
1356  message_stats(this), message_topic(this),
1357 
1358  message_chgident(this), message_setname(this, "SETNAME"), message_chgname(this, "FNAME"), message_capab(this), message_encap(this),
1359  message_endburst(this),
1360  message_fhost(this, "FHOST"), message_sethost(this, "SETHOST"), message_fjoin(this), message_fmode(this), message_ftopic(this),
1361  message_idle(this), message_metadata(this), message_mode(this), message_nick(this), message_opertype(this), message_rsquit(this),
1362  message_setident(this), message_server(this), message_squit(this), message_time(this), message_uid(this)
1363  {
1364  Servers::Capab.insert("NOQUIT");
1365  }
1366 
1368  {
1369  /* InspIRCd 1.2 doesn't set -r on nick change, remove -r here. Note that if we have to set +r later
1370  * this will cancel out this -r, resulting in no mode changes.
1371  *
1372  * Do not set -r if we dont have a NickServ loaded - DP
1373  */
1374  BotInfo *NickServ = Config->GetClient("NickServ");
1375  if (NickServ)
1376  u->RemoveMode(NickServ, "REGISTERED");
1377  }
1378 };
1379 
Serialize::Reference< NickCore > nc
Definition: account.h:47
IRCDMessageEndburst(Module *creator)
Definition: inspircd12.cpp:892
Definition: bots.h:24
IRCDMessageChgName message_setname
bool HasMode(const Anope::string &name) const
Definition: users.cpp:513
bool CanSZLine
Definition: protocol.h:61
void SendDelLine(const Anope::string &xtype, const Anope::string &mask)
Definition: inspircd12.cpp:75
Anope::string target
Definition: sasl.h:14
static NickAlias * Find(const Anope::string &nick)
Definition: nickalias.cpp:121
void SendVhostDel(User *u) anope_override
Definition: inspircd12.cpp:152
Definition: servers.h:42
bool equals_cs(const char *_str) const
Definition: anope.h:74
IRCDMessageServer(Module *creator)
Anope::string name
Definition: modules.h:221
Anope::string reason
Definition: xline.h:29
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: inspircd12.cpp:861
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override
Definition: inspircd12.cpp:96
SQuit(Module *creator, const Anope::string &mname="SQUIT")
Definition: messages.h:134
Anope::string mask
Definition: xline.h:24
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: inspircd12.cpp:918
IRCDMessageSQuit message_squit
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
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
Definition: inspircd12.cpp:254
IRCDMessageMetadata message_metadata
void clear()
Definition: anope.h:187
static Anope::string rsquit_server
Definition: inspircd12.cpp:24
Message::Kick message_kick
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Message::Error message_error
void SetMode(BotInfo *bi, UserMode *um, const Anope::string &param="")
Definition: users.cpp:573
void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost)
Definition: inspircd12.cpp:62
void SendSZLine(User *, const XLine *x) anope_override
Definition: inspircd12.cpp:329
Message::Topic message_topic
time_t signon
Definition: users.h:79
virtual void SendSVSKillInternal(const MessageSource &, User *, const Anope::string &)
Definition: protocol.cpp:100
CoreExport time_t StartTime
Definition: main.cpp:40
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
IRCDMessageMode(Module *creator)
IRCDMessageRSQuit message_rsquit
Anope::string fingerprint
Definition: users.h:73
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: inspircd12.cpp:894
IRCDMessageCapab message_capab
time_t lastmsg
Definition: bots.h:31
CoreExport string Version()
Definition: misc.cpp:625
CoreExport std::set< Anope::string > Capab
Definition: servers.cpp:29
Message::Stats message_stats
IRCDMessageSQuit(Module *creator)
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
InspIRCd12Proto ircd_proto
IRCDMessageFJoin(Module *creator)
Definition: inspircd12.cpp:916
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: inspircd12.cpp:871
IRCDMessageNick message_nick
IRCDMessageUID message_uid
const Anope::string & GetSID() const
Definition: servers.cpp:203
static void RebuildStatusModes()
Definition: modes.cpp:594
Anope::string data
Definition: sasl.h:16
void SendBOB() anope_override
Definition: inspircd12.cpp:358
void SendSQLine(User *, const XLine *x) anope_override
Definition: inspircd12.cpp:288
void SendSVSLogin(const Anope::string &uid, const Anope::string &acc) anope_override
Definition: inspircd12.cpp:406
Message::Kill message_kill
void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) anope_override
Definition: inspircd12.cpp:217
void SendSWhois(const MessageSource &, const Anope::string &who, const Anope::string &mask) anope_override
Definition: inspircd12.cpp:351
const Anope::string & GetProtocolName()
Definition: protocol.cpp:43
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
IRCDMessageServer message_server
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: inspircd12.cpp:847
T * Extend(const Anope::string &name, const T &what)
Definition: extensible.h:224
Message::Privmsg message_privmsg
Anope::string DefaultPseudoclientModes
Definition: protocol.h:47
IRCDMessageFJoin message_fjoin
IRCDMessageTime(Module *creator)
void SendAkillDel(const XLine *x) anope_override
Definition: inspircd12.cpp:106
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: inspircd12.cpp:966
IRCDMessageFTopic message_ftopic
IRCDMessageFHost message_sethost
bool IsJuped() const
Definition: servers.cpp:319
IRCDMessageFHost(Module *creator, const Anope::string &n)
Definition: inspircd12.cpp:906
void SendLogin(User *u, NickAlias *na) anope_override
Definition: inspircd12.cpp:378
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
bool CanSetVHost
Definition: protocol.h:53
bool equals_ci(const char *_str) const
Definition: anope.h:78
Definition: sockets.h:87
bool RequiresID
Definition: protocol.h:69
Message::Part message_part
void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override
Definition: inspircd12.cpp:297
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: inspircd12.cpp:995
CoreExport time_t CurTime
Definition: main.cpp:41
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) anope_override
Definition: inspircd12.cpp:338
void Sync(bool sync_links)
Definition: servers.cpp:250
#define FOREACH_MOD(ename, args)
Definition: modules.h:62
Message::Ping message_ping
iterator erase(const iterator &i)
Definition: anope.h:155
void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override
Definition: inspircd12.cpp:370
IRCDMessageSetIdent message_setident
string substr(size_type pos=0, size_type n=npos) const
Definition: anope.h:277
Message::MOTD message_motd
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
IRCDMessageMetadata(Module *creator)
bool CanSetVIdent
Definition: protocol.h:53
size_type length() const
Definition: anope.h:131
void SendConnect() anope_override
Definition: inspircd12.cpp:305
CoreExport bool Quitting
Definition: main.cpp:34
bool Matches(User *u, const Entry *e) anope_override
Definition: inspircd12.cpp:460
bool CanSQLine
Definition: protocol.h:57
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: messages.cpp:382
Definition: Config.cs:26
bool CanSVSNick
Definition: protocol.h:49
bool CanCertFP
Definition: protocol.h:67
InspIRCdExtBan(const Anope::string &mname, char modeChar)
Definition: inspircd12.cpp:458
IRCDMessageTime message_time
void SendClientIntroduction(User *u) anope_override
Definition: inspircd12.cpp:227
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
Message::Invite message_invite
static std::list< SASLUser > saslusers
Definition: inspircd12.cpp:22
static bool AddUserMode(UserMode *um)
Definition: modes.cpp:391
Message::Quit message_quit
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: inspircd12.cpp:849
void SetFlag(IRCDMessageFlag f)
Definition: protocol.h:282
static ServiceReference< SASL::Service > sasl("SASL::Service","sasl")
void SetIdent(const Anope::string &ident)
Definition: users.cpp:255
const Anope::string & GetUID() const
Definition: users.cpp:230
Message::Join message_join
IRCDMessageIdle(Module *creator)
void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason)
Definition: inspircd12.cpp:70
IRCDMessageCapab(Module *creator)
Definition: inspircd12.cpp:508
void SendAkill(User *u, XLine *x) anope_override
Definition: inspircd12.cpp:163
void ChangeTopicInternal(const Anope::string &user, const Anope::string &newtopic, time_t ts=Anope::CurTime)
Definition: channels.cpp:786
void SendSASLMessage(const SASL::Message &message) anope_override
Definition: inspircd12.cpp:401
void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override
Definition: inspircd12.cpp:222
Definition: modes.h:68
void SendServer(const Server *server) anope_override
Definition: inspircd12.cpp:234
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: inspircd12.cpp:908
virtual void SendSZLineDel(const XLine *)
Definition: protocol.h:117
void SendChannel(Channel *c) anope_override
Definition: inspircd12.cpp:392
void SendTopic(const MessageSource &source, Channel *c) anope_override
Definition: inspircd12.cpp:135
time_t created
Definition: inspircd12.cpp:19
static ChannelMode * FindChannelModeByChar(char mode)
Definition: modes.cpp:524
Anope::string by
Definition: xline.h:26
virtual void SendServer(const Server *)=0
time_t expires
Definition: xline.h:28
void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) anope_override
Definition: inspircd12.cpp:343
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
IRCDMessageSetIdent(Module *creator)
IRCDMessageFMode message_fmode
static Anope::map< std::pair< bool, Anope::string > > modes
Definition: cs_mode.cpp:745
#define anope_override
Definition: services.h:56
IRCDMessageEndburst message_endburst
bool empty() const
Definition: anope.h:126
Anope::string id
Definition: xline.h:31
IRCDMessageChgName(Module *creator, const Anope::string &n)
Definition: inspircd12.cpp:859
void SetModesInternal(MessageSource &source, const Anope::string &mode, time_t ts=0, bool enforce_mlock=true)
Definition: channels.cpp:595
IRCDMessageIdle message_idle
ChannelModeFlood(char modeChar, bool minusNoArg)
Definition: inspircd12.cpp:29
static Server * Find(const Anope::string &name, bool name_only=false)
Definition: servers.cpp:337
void SendSQLineDel(const XLine *x) anope_override
Definition: inspircd12.cpp:282
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Anope::string ext
Definition: sasl.h:17
CoreExport IRCDProto * IRCD
Definition: protocol.cpp:23
std::basic_string< char, ci_char_traits, std::allocator< char > > string
Definition: hashcomp.h:133
Anope::string uid
Definition: inspircd12.cpp:17
IRCDMessageFHost message_fhost
#define MODULE_INIT(x)
Definition: modules.h:45
Server * server
Definition: users.h:77
Anope::string acc
Definition: inspircd12.cpp:18
ChanUserContainer * FindUser(User *u) const
Definition: channels.cpp:173
Anope::string type
Definition: sasl.h:15
static Module * FindFirstOf(ModType type)
CoreExport string VersionBuildString()
Definition: misc.cpp:639
void SendSquit(Server *s, const Anope::string &message) anope_override
Definition: inspircd12.cpp:241
virtual void SendSZLine(User *u, const XLine *)
Definition: protocol.h:116
bool CanSVSHold
Definition: protocol.h:63
ChannelStatus status
Definition: channels.h:28
void Login(NickCore *core)
Definition: users.cpp:391
void RemoveMode(BotInfo *bi, UserMode *um, const Anope::string &param="")
Definition: users.cpp:587
CoreExport int CurrentUplink
Definition: main.cpp:43
ExtensibleItem< bool > ssl
void SendSZLineDel(const XLine *x) anope_override
Definition: inspircd12.cpp:323
std::pair< ChannelStatus, User * > SJoinUser
Definition: messages.h:57
IRCDMessageChgIdent message_chgident
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
void Clear()
Definition: modes.cpp:91
const Anope::string & GetName() const
Definition: servers.cpp:175
static bool AddChannelMode(ChannelMode *cm)
Definition: modes.cpp:418
IRCDMessageChgName message_chgname
void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override
Definition: inspircd12.cpp:101
void OnUserNickChange(User *u, const Anope::string &) anope_override
iterator end()
Definition: anope.h:284
static Channel * Find(const Anope::string &name)
Definition: channels.cpp:920
Definition: xline.h:18
void SendOper(User *u) anope_override
Definition: inspircd12.cpp:397
bool GetToken(Anope::string &token)
Definition: hashcomp.cpp:99
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
void SendLogout(User *u) anope_override
Definition: inspircd12.cpp:387
CoreExport Server * Me
Definition: servers.cpp:24
CoreExport user_map UserListByNick
Definition: users.cpp:28
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
const Anope::string & Modes() const
Definition: modes.cpp:96
IRCDMessageOperType message_opertype
IRCDMessageOperType(Module *creator)
void SetModesInternal(const MessageSource &source, const char *umodes,...)
Definition: users.cpp:645
const char * c_str() const
Definition: anope.h:117
Definition: logger.h:53
IRCDMessageFMode(Module *creator)
Definition: inspircd12.cpp:964
void SendEOB() anope_override
Definition: inspircd12.cpp:365
bool CanSVSJoin
Definition: protocol.h:51
IRCDMessageEncap(Module *creator)
Definition: inspircd12.cpp:869
void SendSVSHold(const Anope::string &nick, time_t t) anope_override
Definition: inspircd12.cpp:311
void SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent)
Definition: inspircd12.cpp:54
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
IRCDMessageUID(Module *creator)
IRCDMessageRSQuit(Module *creator)
Definition: modes.h:388
void AddXLine(XLine *x)
Definition: xline.cpp:286
Message::Notice message_notice
IRCDMessageFTopic(Module *creator)
Definition: inspircd12.cpp:993
Anope::string name
Definition: modes.h:43
ProtoInspIRCd12(const Anope::string &modname, const Anope::string &creator)
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
static NickCore * Find(const Anope::string &nick)
Definition: nickcore.cpp:258
iterator begin()
Definition: anope.h:282
bool IsValid(Anope::string &value) const anope_override
Definition: inspircd12.cpp:31
size_type find(const string &_str, size_type pos=0) const
Definition: anope.h:192
CoreExport Anope::string QuitReason
Definition: main.cpp:36
static BotInfo * Find(const Anope::string &nick, bool nick_only=false)
Definition: bots.cpp:249
IRCDMessageNick(Module *creator)
Message::Away message_away
bool IsExtbanValid(const Anope::string &mask) anope_override
Definition: inspircd12.cpp:428
string replace(size_type pos, size_type n, const string &_str)
Definition: anope.h:223
static Anope::string rsquit_id
Definition: inspircd12.cpp:24
void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override
Definition: inspircd12.cpp:48
bool IsIdentValid(const Anope::string &ident) anope_override
Definition: inspircd12.cpp:433
IRCDMessageMode message_mode
IRCDMessageEncap message_encap
void Delete(const Anope::string &reason)
Definition: servers.cpp:167
InspIRCd12Proto(Module *creator)
Definition: inspircd12.cpp:81
void SendSVSHoldDel(const Anope::string &nick) anope_override
Definition: inspircd12.cpp:317
Server * GetUplink()
Definition: servers.cpp:221
void Run(MessageSource &source, const std::vector< Anope::string > &params) anope_override
Definition: inspircd12.cpp:510