Anope IRC Services  Version 2.0
users.cpp
Go to the documentation of this file.
1 /* Routines to maintain a list of online users.
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 
13 
14 #include "services.h"
15 #include "modules.h"
16 #include "users.h"
17 #include "account.h"
18 #include "protocol.h"
19 #include "servers.h"
20 #include "channels.h"
21 #include "bots.h"
22 #include "config.h"
23 #include "opertype.h"
24 #include "language.h"
25 #include "sockets.h"
26 #include "uplink.h"
27 
29 
30 int OperCount = 0;
31 unsigned MaxUserCount = 0;
32 time_t MaxUserTime = 0;
33 
34 std::list<User *> User::quitting_users;
35 
36 User::User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &uip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *account) : ip(uip)
37 {
38  if (snick.empty() || sident.empty() || shost.empty())
39  throw CoreException("Bad args passed to User::User");
40 
41  /* we used to do this by calloc, no more. */
42  quit = false;
43  server = NULL;
45  on_access = false;
46 
47  this->nick = snick;
48  this->ident = sident;
49  this->host = shost;
50  this->vhost = svhost;
51  this->chost = svhost;
52  this->server = sserver;
53  this->realname = srealname;
54  this->timestamp = this->signon = ts;
55  this->SetModesInternal(sserver, "%s", smodes.c_str());
56  this->uid = suid;
57  this->super_admin = false;
58  this->nc = NULL;
59 
60  size_t old = UserListByNick.size();
61  UserListByNick[snick] = this;
62  if (!suid.empty())
63  UserListByUID[suid] = this;
64  if (old == UserListByNick.size())
65  Log(LOG_DEBUG) << "Duplicate user " << snick << " in user table?";
66 
67  this->Login(account);
68  this->UpdateHost();
69 
70  if (sserver) // Our bots are introduced on startup with no server
71  {
72  ++sserver->users;
73  if (server->IsSynced())
74  Log(this, "connect") << (!vhost.empty() && vhost != host ? "(" + vhost + ") " : "") << "(" << srealname << ") " << (!uip.empty() && uip != host ? "[" + uip + "] " : "") << "connected to the network (" << sserver->GetName() << ")";
75  }
76 
77  if (UserListByNick.size() > MaxUserCount)
78  {
79  MaxUserCount = UserListByNick.size();
81  if (sserver && sserver->IsSynced())
82  Log(this, "maxusers") << "connected - new maximum user count: " << UserListByNick.size();
83  }
84 
85  bool exempt = false;
86  if (server && server->IsULined())
87  exempt = true;
88  FOREACH_MOD(OnUserConnect, (this, exempt));
89 }
90 
91 static void CollideKill(User *target, const Anope::string &reason)
92 {
93  if (target->server != Me)
94  target->Kill(Me, reason);
95  else
96  {
97  // Be sure my user is really dead
98  IRCD->SendQuit(target, "%s", reason.c_str());
99 
100  // Reintroduce my client
101  if (BotInfo *bi = dynamic_cast<BotInfo *>(target))
102  bi->OnKill();
103  else
104  target->Quit(reason);
105  }
106 }
107 
108 static void Collide(User *u, const Anope::string &id, const Anope::string &type)
109 {
110  // Kill incoming user
111  IRCD->SendKill(Me, id, type);
112  // Quit colliding user
113  CollideKill(u, type);
114 }
115 
116 User* 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)
117 {
118  // How IRCds handle collisions varies a lot, for safety well just always kill both sides
119  // With properly set qlines, this can almost never happen anyway
120 
121  User *u = User::Find(snick, true);
122  if (u)
123  {
124  Collide(u, !suid.empty() ? suid : snick, "Nick collision");
125  return NULL;
126  }
127 
128  if (!suid.empty())
129  {
130  u = User::Find(suid);
131  if (u)
132  {
133  Collide(u, suid, "ID collision");
134  return NULL;
135  }
136  }
137 
138  return new User(snick, sident, shost, svhost, sip, sserver, srealname, ts, smodes, suid, nc);
139 }
140 
141 void User::ChangeNick(const Anope::string &newnick, time_t ts)
142 {
143  /* Sanity check to make sure we don't segfault */
144  if (newnick.empty())
145  throw CoreException("User::ChangeNick() got a bad argument");
146 
147  this->super_admin = false;
148  Log(this, "nick") << "(" << this->realname << ") changed nick to " << newnick;
149 
150  Anope::string old = this->nick;
151  this->timestamp = ts;
152 
153  if (this->nick.equals_ci(newnick))
154  this->nick = newnick;
155  else
156  {
157  NickAlias *old_na = NickAlias::Find(this->nick);
158  if (old_na && (this->IsIdentified(true) || this->IsRecognized()))
159  old_na->last_seen = Anope::CurTime;
160 
161  UserListByNick.erase(this->nick);
162 
163  this->nick = newnick;
164 
165  User* &other = UserListByNick[this->nick];
166  if (other)
167  {
168  CollideKill(this, "Nick collision");
169  CollideKill(other, "Nick collision");
170  return;
171  }
172  other = this;
173 
174  on_access = false;
175  NickAlias *na = NickAlias::Find(this->nick);
176  if (na)
177  on_access = na->nc->IsOnAccess(this);
178 
179  if (na && na->nc == this->Account())
180  {
182  this->UpdateHost();
183  }
184  }
185 
186  FOREACH_MOD(OnUserNickChange, (this, old));
187 }
188 
190 {
191  if (shost.empty())
192  throw CoreException("empty host? in MY services? it seems it's more likely than I thought.");
193 
194  this->vhost = shost;
195 
196  Log(this, "host") << "changed vhost to " << shost;
197 
198  FOREACH_MOD(OnSetDisplayedHost, (this));
199 
200  this->UpdateHost();
201 }
202 
204 {
205  if (!this->vhost.empty())
206  return this->vhost;
207  else if (this->HasMode("CLOAK") && !this->GetCloakedHost().empty())
208  return this->GetCloakedHost();
209  else
210  return this->host;
211 }
212 
214 {
215  if (newhost.empty())
216  throw CoreException("empty host in User::SetCloakedHost");
217 
218  chost = newhost;
219 
220  Log(this, "host") << "changed cloaked host to " << newhost;
221 
222  this->UpdateHost();
223 }
224 
226 {
227  return chost;
228 }
229 
231 {
232  if (!this->uid.empty() && IRCD->RequiresID)
233  return this->uid;
234  else
235  return this->nick;
236 }
237 
238 void User::SetVIdent(const Anope::string &sident)
239 {
240  this->vident = sident;
241 
242  Log(this, "ident") << "changed vident to " << sident;
243 
244  this->UpdateHost();
245 }
246 
248 {
249  if (!this->vident.empty())
250  return this->vident;
251  else
252  return this->ident;
253 }
254 
255 void User::SetIdent(const Anope::string &sident)
256 {
257  this->ident = sident;
258 
259  Log(this, "ident") << "changed real ident to " << sident;
260 
261  this->UpdateHost();
262 }
263 
265 {
266  return this->ident;
267 }
268 
270 {
271  return this->nick + "!" + this->ident + "@" + this->host;
272 }
273 
275 {
276  return this->nick + "!" + this->GetVIdent() + "@" + this->GetDisplayedHost();
277 }
278 
279 void User::SetRealname(const Anope::string &srealname)
280 {
281  if (srealname.empty())
282  throw CoreException("realname empty in SetRealname");
283 
284  this->realname = srealname;
285  NickAlias *na = NickAlias::Find(this->nick);
286 
287  if (na && (this->IsIdentified(true) || this->IsRecognized()))
288  na->last_realname = srealname;
289 
290  Log(this, "realname") << "changed realname to " << srealname;
291 }
292 
294 {
295  if (this->server != NULL)
296  {
297  if (this->server->IsSynced())
298  Log(this, "disconnect") << "(" << this->realname << ") disconnected from the network (" << this->server->GetName() << ")";
299  --this->server->users;
300  }
301 
302  FOREACH_MOD(OnPreUserLogoff, (this));
303 
305  this->Logout();
306 
307  if (this->HasMode("OPER"))
308  --OperCount;
309 
310  while (!this->chans.empty())
311  this->chans.begin()->second->chan->DeleteUser(this);
312 
313  UserListByNick.erase(this->nick);
314  if (!this->uid.empty())
315  UserListByUID.erase(this->uid);
316 
317  FOREACH_MOD(OnPostUserLogoff, (this));
318 }
319 
320 void User::SendMessage(BotInfo *source, const char *fmt, ...)
321 {
322  va_list args;
323  char buf[BUFSIZE] = "";
324 
325  const char *translated_message = Language::Translate(this, fmt);
326 
327  va_start(args, fmt);
328  vsnprintf(buf, BUFSIZE - 1, translated_message, args);
329 
330  this->SendMessage(source, Anope::string(buf));
331 
332  va_end(args);
333 }
334 
335 void User::SendMessage(BotInfo *source, const Anope::string &msg)
336 {
337  const char *translated_message = Language::Translate(this, msg.c_str());
338 
339  /* Send privmsg instead of notice if:
340  * - UsePrivmsg is enabled
341  * - The user is not registered and NSDefMsg is enabled
342  * - The user is registered and has set /ns set msg on
343  */
344  bool send_privmsg = Config->UsePrivmsg && ((!this->nc && Config->DefPrivmsg) || (this->nc && this->nc->HasExt("MSG")));
345  sepstream sep(translated_message, '\n', true);
346  for (Anope::string tok; sep.GetToken(tok);)
347  {
348  if (send_privmsg)
349  IRCD->SendPrivmsg(source, this->GetUID(), "%s", tok.c_str());
350  else
351  IRCD->SendNotice(source, this->GetUID(), "%s", tok.c_str());
352  }
353 }
354 
356 {
357  if (this->nick.equals_ci(na->nick))
358  {
359  na->last_usermask = this->GetIdent() + "@" + this->GetDisplayedHost();
360  na->last_realhost = this->GetIdent() + "@" + this->host;
361  na->last_realname = this->realname;
363  }
364 
365  IRCD->SendLogin(this, na);
366 
367  this->Login(na->nc);
368 
369  FOREACH_MOD(OnNickIdentify, (this));
370 
371  if (this->IsServicesOper())
372  {
373  if (!this->nc->o->ot->modes.empty())
374  {
375  this->SetModes(NULL, "%s", this->nc->o->ot->modes.c_str());
376  this->SendMessage(NULL, "Changing your usermodes to \002%s\002", this->nc->o->ot->modes.c_str());
378  if (um && !this->HasMode("OPER") && this->nc->o->ot->modes.find(um->mchar) != Anope::string::npos)
379  IRCD->SendOper(this);
380  }
381  if (IRCD->CanSetVHost && !this->nc->o->vhost.empty())
382  {
383  this->SendMessage(NULL, "Changing your vhost to \002%s\002", this->nc->o->vhost.c_str());
384  this->SetDisplayedHost(this->nc->o->vhost);
385  IRCD->SendVhost(this, "", this->nc->o->vhost);
386  }
387  }
388 }
389 
390 
392 {
393  if (!core || core == this->nc)
394  return;
395 
396  this->Logout();
397  this->nc = core;
398  core->users.push_back(this);
399 
400  this->UpdateHost();
401 
402  if (this->server->IsSynced())
403  Log(this, "account") << "is now identified as " << this->nc->display;
404 
405  FOREACH_MOD(OnUserLogin, (this));
406 }
407 
409 {
410  if (!this->nc)
411  return;
412 
413  Log(this, "account") << "is no longer identified as " << this->nc->display;
414 
415  std::list<User *>::iterator it = std::find(this->nc->users.begin(), this->nc->users.end(), this);
416  if (it != this->nc->users.end())
417  this->nc->users.erase(it);
418 
419  this->nc = NULL;
420 }
421 
423 {
424  return this->nc;
425 }
426 
427 bool User::IsIdentified(bool check_nick) const
428 {
429  if (check_nick && this->nc)
430  {
431  NickAlias *na = NickAlias::Find(this->nick);
432  return na && *na->nc == *this->nc;
433  }
434 
435  return this->nc ? true : false;
436 }
437 
438 bool User::IsRecognized(bool check_secure) const
439 {
440  if (check_secure && on_access)
441  {
442  const NickAlias *na = NickAlias::Find(this->nick);
443 
444  if (!na || na->nc->HasExt("NS_SECURE"))
445  return false;
446  }
447 
448  return on_access;
449 }
450 
452 {
453  if (!this->nc || !this->nc->IsServicesOper())
454  // No opertype.
455  return false;
456  else if (this->nc->o->require_oper && !this->HasMode("OPER"))
457  return false;
458  else if (!this->nc->o->certfp.empty() && this->fingerprint != this->nc->o->certfp)
459  // Certfp mismatch
460  return false;
461  else if (!this->nc->o->hosts.empty())
462  {
463  bool match = false;
464  Anope::string match_host = this->GetIdent() + "@" + this->host;
465  for (unsigned i = 0; i < this->nc->o->hosts.size(); ++i)
466  if (Anope::Match(match_host, this->nc->o->hosts[i]))
467  match = true;
468  if (match == false)
469  return false;
470  }
471 
472  EventReturn MOD_RESULT;
473  FOREACH_RESULT(IsServicesOper, MOD_RESULT, (this));
474  if (MOD_RESULT == EVENT_STOP)
475  return false;
476 
477  return true;
478 }
479 
480 bool User::HasCommand(const Anope::string &command)
481 {
482  if (this->IsServicesOper())
483  return this->nc->o->ot->HasCommand(command);
484  return false;
485 }
486 
487 bool User::HasPriv(const Anope::string &priv)
488 {
489  if (this->IsServicesOper())
490  return this->nc->o->ot->HasPriv(priv);
491  return false;
492 }
493 
495 {
496  if (this->host.empty())
497  return;
498 
499  NickAlias *na = NickAlias::Find(this->nick);
500  on_access = false;
501  if (na)
502  on_access = na->nc->IsOnAccess(this);
503 
504  if (na && (this->IsIdentified(true) || this->IsRecognized()))
505  {
506  Anope::string last_usermask = this->GetIdent() + "@" + this->GetDisplayedHost();
507  Anope::string last_realhost = this->GetIdent() + "@" + this->host;
508  na->last_usermask = last_usermask;
509  na->last_realhost = last_realhost;
510  }
511 }
512 
513 bool User::HasMode(const Anope::string &mname) const
514 {
515  return this->modes.count(mname);
516 }
517 
518 void User::SetModeInternal(const MessageSource &source, UserMode *um, const Anope::string &param)
519 {
520  if (!um)
521  return;
522 
523  this->modes[um->name] = param;
524 
525  if (um->name == "OPER")
526  {
527  ++OperCount;
528 
529  if (this->IsServicesOper())
530  {
531  if (!this->nc->o->ot->modes.empty())
532  {
533  this->SetModes(NULL, "%s", this->nc->o->ot->modes.c_str());
534  this->SendMessage(NULL, "Changing your usermodes to \002%s\002", this->nc->o->ot->modes.c_str());
536  if (oper && !this->HasMode("OPER") && this->nc->o->ot->modes.find(oper->mchar) != Anope::string::npos)
537  IRCD->SendOper(this);
538  }
539  if (IRCD->CanSetVHost && !this->nc->o->vhost.empty())
540  {
541  this->SendMessage(NULL, "Changing your vhost to \002%s\002", this->nc->o->vhost.c_str());
542  this->SetDisplayedHost(this->nc->o->vhost);
543  IRCD->SendVhost(this, "", this->nc->o->vhost);
544  }
545  }
546  }
547 
548  if (um->name == "CLOAK" || um->name == "VHOST")
549  this->UpdateHost();
550 
551  FOREACH_MOD(OnUserModeSet, (source, this, um->name));
552 }
553 
555 {
556  if (!um)
557  return;
558 
559  this->modes.erase(um->name);
560 
561  if (um->name == "OPER")
562  --OperCount;
563 
564  if (um->name == "CLOAK" || um->name == "VHOST")
565  {
566  this->vhost.clear();
567  this->UpdateHost();
568  }
569 
570  FOREACH_MOD(OnUserModeUnset, (source, this, um->name));
571 }
572 
573 void User::SetMode(BotInfo *bi, UserMode *um, const Anope::string &param)
574 {
575  if (!um || HasMode(um->name))
576  return;
577 
578  ModeManager::StackerAdd(bi, this, um, true, param);
579  SetModeInternal(bi, um, param);
580 }
581 
582 void User::SetMode(BotInfo *bi, const Anope::string &uname, const Anope::string &param)
583 {
584  SetMode(bi, ModeManager::FindUserModeByName(uname), param);
585 }
586 
587 void User::RemoveMode(BotInfo *bi, UserMode *um, const Anope::string &param)
588 {
589  if (!um || !HasMode(um->name))
590  return;
591 
592  ModeManager::StackerAdd(bi, this, um, false, param);
593  RemoveModeInternal(bi, um);
594 }
595 
596 void User::RemoveMode(BotInfo *bi, const Anope::string &name, const Anope::string &param)
597 {
599 }
600 
601 void User::SetModes(BotInfo *bi, const char *umodes, ...)
602 {
603  char buf[BUFSIZE] = "";
604  va_list args;
605  Anope::string modebuf, sbuf;
606  int add = -1;
607  va_start(args, umodes);
608  vsnprintf(buf, BUFSIZE - 1, umodes, args);
609  va_end(args);
610 
611  spacesepstream sep(buf);
612  sep.GetToken(modebuf);
613  for (unsigned i = 0, end = modebuf.length(); i < end; ++i)
614  {
615  UserMode *um;
616 
617  switch (modebuf[i])
618  {
619  case '+':
620  add = 1;
621  continue;
622  case '-':
623  add = 0;
624  continue;
625  default:
626  if (add == -1)
627  continue;
628  um = ModeManager::FindUserModeByChar(modebuf[i]);
629  if (!um)
630  continue;
631  }
632 
633  if (add)
634  {
635  if (um->type == MODE_PARAM && sep.GetToken(sbuf))
636  this->SetMode(bi, um, sbuf);
637  else
638  this->SetMode(bi, um);
639  }
640  else
641  this->RemoveMode(bi, um);
642  }
643 }
644 
645 void User::SetModesInternal(const MessageSource &source, const char *umodes, ...)
646 {
647  char buf[BUFSIZE] = "";
648  va_list args;
649  Anope::string modebuf, sbuf;
650  int add = -1;
651  va_start(args, umodes);
652  vsnprintf(buf, BUFSIZE - 1, umodes, args);
653  va_end(args);
654 
655  if (this->server && this->server->IsSynced() && Anope::string(buf) != "+")
656  Log(this, "mode") << "changes modes to " << buf;
657 
658  spacesepstream sep(buf);
659  sep.GetToken(modebuf);
660  for (unsigned i = 0, end = modebuf.length(); i < end; ++i)
661  {
662  UserMode *um;
663 
664  switch (modebuf[i])
665  {
666  case '+':
667  add = 1;
668  continue;
669  case '-':
670  add = 0;
671  continue;
672  default:
673  if (add == -1)
674  continue;
675  um = ModeManager::FindUserModeByChar(modebuf[i]);
676  if (!um)
677  continue;
678  }
679 
680  if (add)
681  {
682  if (um->type == MODE_PARAM && sep.GetToken(sbuf))
683  this->SetModeInternal(source, um, sbuf);
684  else
685  this->SetModeInternal(source, um);
686  }
687  else
688  this->RemoveModeInternal(source, um);
689  }
690 }
691 
693 {
694  Anope::string m, params;
695 
696  for (ModeList::const_iterator it = this->modes.begin(), it_end = this->modes.end(); it != it_end; ++it)
697  {
698  UserMode *um = ModeManager::FindUserModeByName(it->first);
699  if (um == NULL)
700  continue;
701 
702  m += um->mchar;
703 
704  if (!it->second.empty())
705  params += " " + it->second;
706  }
707 
708  return m + params;
709 }
710 
712 {
713  return modes;
714 }
715 
717 {
718  User::ChanUserList::const_iterator it = this->chans.find(c);
719  if (it != this->chans.end())
720  return it->second;
721  return NULL;
722 }
723 
725 {
726  return this->HasMode("PROTECTED") || this->HasMode("GOD") || this->HasPriv("protected") || (this->server && this->server->IsULined());
727 }
728 
729 void User::Kill(const MessageSource &source, const Anope::string &reason)
730 {
731  Anope::string real_reason = source.GetName() + " (" + reason + ")";
732 
733  IRCD->SendSVSKill(source, this, "%s", real_reason.c_str());
734 }
735 
736 void User::KillInternal(const MessageSource &source, const Anope::string &reason)
737 {
738  if (this->quit)
739  {
740  Log(LOG_DEBUG) << "Duplicate quit for " << this->nick;
741  return;
742  }
743 
744  Log(this, "killed") << "was killed by " << source.GetName() << " (Reason: " << reason << ")";
745 
746  this->Quit(reason);
747 }
748 
749 void User::Quit(const Anope::string &reason)
750 {
751  if (this->quit)
752  {
753  Log(LOG_DEBUG) << "Duplicate quit for " << this->nick;
754  return;
755  }
756 
757  FOREACH_MOD(OnUserQuit, (this, reason));
758 
759  this->quit = true;
760  quitting_users.push_back(this);
761 }
762 
763 bool User::Quitting() const
764 {
765  return this->quit;
766 }
767 
769 {
770  Anope::string mask;
771  const Anope::string &mident = this->GetIdent();
772  const Anope::string &mhost = this->GetDisplayedHost();
773 
774  if (mident[0] == '~')
775  mask = "*" + mident + "@";
776  else
777  mask = mident + "@";
778 
779  sockaddrs addr(mhost);
780  if (addr.valid() && addr.sa.sa_family == AF_INET)
781  {
782  size_t dot = mhost.find('.');
783  mask += mhost.substr(0, dot) + (dot == Anope::string::npos ? "" : ".*");
784  }
785  else
786  {
787  size_t dot = mhost.find('.');
788  if (dot != Anope::string::npos && mhost.find('.', dot + 1) != Anope::string::npos)
789  mask += "*" + mhost.substr(dot);
790  else
791  mask += mhost;
792  }
793 
794  return mask;
795 }
796 
798 {
799  if (!Config->GetBlock("options")->Get<int>("badpasslimit"))
800  return false;
801 
802  if (Config->GetBlock("options")->Get<time_t>("badpasstimeout") > 0 && this->invalid_pw_time > 0 && this->invalid_pw_time < Anope::CurTime - Config->GetBlock("options")->Get<time_t>("badpasstimeout"))
803  this->invalid_pw_count = 0;
804  ++this->invalid_pw_count;
806  if (this->invalid_pw_count >= Config->GetBlock("options")->Get<int>("badpasslimit"))
807  {
808  this->Kill(Me->GetName(), "Too many invalid passwords");
809  return true;
810  }
811 
812  return false;
813 }
814 
815 User* User::Find(const Anope::string &name, bool nick_only)
816 {
817  if (!nick_only && IRCD->RequiresID)
818  {
819  user_map::iterator it = UserListByUID.find(name);
820  if (it != UserListByUID.end())
821  return it->second;
822 
823  if (IRCD->AmbiguousID)
824  return NULL;
825  }
826 
827  user_map::iterator it = UserListByNick.find(name);
828  if (it != UserListByNick.end())
829  return it->second;
830 
831  return NULL;
832 }
833 
835 {
836  for (std::list<User *>::iterator it = quitting_users.begin(), it_end = quitting_users.end(); it != it_end; ++it)
837  delete *it;
838  quitting_users.clear();
839 }
840 
Serialize::Reference< NickCore > nc
Definition: account.h:47
Definition: bots.h:24
bool HasMode(const Anope::string &name) const
Definition: users.cpp:513
static void QuitUsers()
Definition: users.cpp:834
static NickAlias * Find(const Anope::string &nick)
Definition: nickalias.cpp:121
Definition: servers.h:42
void SetCloakedHost(const Anope::string &newhost)
Definition: users.cpp:213
bool AmbiguousID
Definition: protocol.h:71
void Kill(const MessageSource &source, const Anope::string &reason)
Definition: users.cpp:729
bool BadPassword()
Definition: users.cpp:797
virtual void SendVhost(User *u, const Anope::string &vident, const Anope::string &vhost)
Definition: protocol.h:99
user_map UserListByNick
Definition: users.cpp:28
void SetModeInternal(const MessageSource &setter, UserMode *um, const Anope::string &param="")
Definition: users.cpp:518
const Anope::string & GetIdent() const
Definition: users.cpp:264
Anope::string uid
Definition: users.h:46
user_map UserListByUID
Definition: users.cpp:28
bool IsSynced() const
Definition: servers.cpp:298
bool HasCommand(const Anope::string &cmdstr)
Definition: users.cpp:480
void clear()
Definition: anope.h:187
void RemoveModeInternal(const MessageSource &setter, UserMode *um)
Definition: users.cpp:554
void SetMode(BotInfo *bi, UserMode *um, const Anope::string &param="")
Definition: users.cpp:573
bool IsRecognized(bool check_secure=true) const
Definition: users.cpp:438
sockaddr sa
Definition: sockets.h:30
time_t signon
Definition: users.h:79
Anope::string ident
Definition: users.h:45
static UserMode * FindUserModeByChar(char mode)
Definition: modes.cpp:533
Anope::string fingerprint
Definition: users.h:73
void Quit(const Anope::string &reason="")
Definition: users.cpp:749
time_t lastmail
Definition: users.h:94
virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const char *fmt,...)
Definition: protocol.cpp:242
Anope::string nick
Definition: account.h:37
virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt,...)
Definition: protocol.cpp:221
Anope::string last_usermask
Definition: account.h:41
ChanUserList chans
Definition: users.h:87
Anope::string vident
Definition: users.h:44
#define BUFSIZE
Definition: services.h:18
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
Definition: users.h:34
virtual void SendSVSKill(const MessageSource &source, User *user, const char *fmt,...)
Definition: protocol.cpp:175
User(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:36
ChanUserContainer * FindChannel(Channel *c) const
Definition: users.cpp:716
static void CollideKill(User *target, const Anope::string &reason)
Definition: users.cpp:91
static std::list< User * > quitting_users
Definition: users.h:39
Anope::string Mask() const
Definition: users.cpp:768
#define FOREACH_RESULT(ename, ret, args)
Definition: modules.h:95
bool CanSetVHost
Definition: protocol.h:53
bool equals_ci(const char *_str) const
Definition: anope.h:78
time_t invalid_pw_time
Definition: users.h:57
virtual void SendQuit(User *u, const char *fmt,...)
Definition: protocol.cpp:252
bool RequiresID
Definition: protocol.h:69
static UserMode * FindUserModeByName(const Anope::string &name)
Definition: modes.cpp:550
CoreExport time_t CurTime
Definition: main.cpp:41
Anope::string GetModes() const
Definition: users.cpp:692
time_t lastmemosend
Definition: users.h:90
#define FOREACH_MOD(ename, args)
Definition: modules.h:62
void Identify(NickAlias *na)
Definition: users.cpp:355
static void Collide(User *u, const Anope::string &id, const Anope::string &type)
Definition: users.cpp:108
time_t lastnickreg
Definition: users.h:92
static void StackerDel(User *u)
Definition: modes.cpp:682
string substr(size_type pos=0, size_type n=npos) const
Definition: anope.h:277
unsigned users
Definition: servers.h:84
bool IsProtected()
Definition: users.cpp:724
time_t timestamp
Definition: users.h:81
size_type length() const
Definition: anope.h:131
bool Quitting() const
Definition: users.cpp:763
ModeType type
Definition: modes.h:49
Definition: Config.cs:26
void SetRealname(const Anope::string &realname)
Definition: users.cpp:279
virtual ~User()
Definition: users.cpp:293
bool valid() const
Definition: sockets.cpp:99
time_t MaxUserTime
Definition: users.cpp:32
CoreExport bool Match(const string &str, const string &mask, bool case_sensitive=false, bool use_regex=false)
Definition: misc.cpp:407
static const size_type npos
Definition: anope.h:44
void SetIdent(const Anope::string &ident)
Definition: users.cpp:255
const Anope::string & GetUID() const
Definition: users.cpp:230
const Anope::string & GetDisplayedHost() const
Definition: users.cpp:203
Anope::string GetDisplayedMask() const
Definition: users.cpp:274
Serialize::Reference< NickCore > nc
Definition: users.h:52
Definition: modes.h:68
bool IsIdentified(bool check_nick=false) const
Definition: users.cpp:427
Anope::string GetMask() const
Definition: users.cpp:269
bool HasPriv(const Anope::string &privstr)
Definition: users.cpp:487
void SetVIdent(const Anope::string &ident)
Definition: users.cpp:238
char mchar
Definition: modes.h:47
const Anope::string & GetVIdent() const
Definition: users.cpp:247
void UpdateHost()
Definition: users.cpp:494
bool empty() const
Definition: anope.h:126
Anope::string host
Definition: users.h:65
void ChangeNick(const Anope::string &newnick, time_t ts=Anope::CurTime)
Definition: users.cpp:141
void Logout()
Definition: users.cpp:408
const ModeList & GetModeList() const
Definition: users.cpp:711
int OperCount
Definition: users.cpp:30
void KillInternal(const MessageSource &source, const Anope::string &reason)
Definition: users.cpp:736
CoreExport IRCDProto * IRCD
Definition: protocol.cpp:23
std::basic_string< char, ci_char_traits, std::allocator< char > > string
Definition: hashcomp.h:133
EventReturn
Definition: modules.h:129
Server * server
Definition: users.h:77
CoreExport const char * Translate(const char *string)
Definition: language.cpp:59
virtual void SendKill(const MessageSource &source, const Anope::string &target, const Anope::string &reason)
Definition: protocol.cpp:95
std::map< Anope::string, Anope::string > ModeList
Definition: users.h:42
void SetDisplayedHost(const Anope::string &host)
Definition: users.cpp:189
void Login(NickCore *core)
Definition: users.cpp:391
static void StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const Anope::string &param="")
Definition: modes.cpp:607
void RemoveMode(BotInfo *bi, UserMode *um, const Anope::string &param="")
Definition: users.cpp:587
void SetModes(BotInfo *bi, const char *umodes,...)
Definition: users.cpp:601
Anope::string realname
Definition: users.h:71
virtual void SendLogin(User *u, NickAlias *na)=0
Anope::string nick
Definition: users.h:62
ModeList modes
Definition: users.h:50
static User * Find(const Anope::string &name, bool nick_only=false)
Definition: users.cpp:815
const Anope::string & GetCloakedHost() const
Definition: users.cpp:225
const Anope::string & GetName() const
Definition: servers.cpp:175
Anope::string chost
Definition: users.h:69
time_t last_seen
Definition: account.h:45
NickCore * Account() const
Definition: users.cpp:422
bool GetToken(Anope::string &token)
Definition: hashcomp.cpp:99
Anope::string name
Definition: access.cpp:22
bool quit
Definition: users.h:37
CoreExport Server * Me
Definition: servers.cpp:24
Anope::string last_realname
Definition: account.h:39
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
bool IsULined() const
Definition: servers.cpp:308
bool on_access
Definition: users.h:48
unsigned MaxUserCount
Definition: users.cpp:31
unsigned short invalid_pw_count
Definition: users.h:55
bool IsServicesOper()
Definition: users.cpp:451
bool super_admin
Definition: users.h:83
std::list< User * > users
Definition: account.h:140
Anope::string name
Definition: modes.h:43
void SendMessage(BotInfo *source, const char *fmt,...)
Definition: users.cpp:320
size_type find(const string &_str, size_type pos=0) const
Definition: anope.h:192
Anope::string vhost
Definition: users.h:67
virtual void SendOper(User *u)
Definition: protocol.cpp:426
Anope::string last_realhost
Definition: account.h:43
const Anope::string & GetName() const
Definition: protocol.cpp:463