Anope IRC Services  Version 2.0
misc.cpp
Go to the documentation of this file.
1 /* Miscellaneous routines.
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 #include "services.h"
14 #include "version.h"
15 #include "modules.h"
16 #include "lists.h"
17 #include "config.h"
18 #include "bots.h"
19 #include "language.h"
20 #include "regexpr.h"
21 #include "sockets.h"
22 
23 #include <errno.h>
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #ifndef _WIN32
27 #include <sys/socket.h>
28 #include <netdb.h>
29 #endif
30 
31 NumberList::NumberList(const Anope::string &list, bool descending) : is_valid(true), desc(descending)
32 {
33  Anope::string error;
34  commasepstream sep(list);
35  Anope::string token;
36 
37  sep.GetToken(token);
38  if (token.empty())
39  token = list;
40  do
41  {
42  size_t t = token.find('-');
43 
44  if (t == Anope::string::npos)
45  {
46  try
47  {
48  unsigned num = convertTo<unsigned>(token, error, false);
49  if (error.empty())
50  numbers.insert(num);
51  }
52  catch (const ConvertException &)
53  {
54  error = "1";
55  }
56 
57  if (!error.empty())
58  {
59  if (!this->InvalidRange(list))
60  {
61  is_valid = false;
62  return;
63  }
64  }
65  }
66  else
67  {
68  Anope::string error2;
69  try
70  {
71  unsigned num1 = convertTo<unsigned>(token.substr(0, t), error, false);
72  unsigned num2 = convertTo<unsigned>(token.substr(t + 1), error2, false);
73  if (error.empty() && error2.empty())
74  for (unsigned i = num1; i <= num2; ++i)
75  numbers.insert(i);
76  }
77  catch (const ConvertException &)
78  {
79  error = "1";
80  }
81 
82  if (!error.empty() || !error2.empty())
83  {
84  if (!this->InvalidRange(list))
85  {
86  is_valid = false;
87  return;
88  }
89  }
90  }
91  } while (sep.GetToken(token));
92 }
93 
95 {
96 }
97 
99 {
100  if (!is_valid)
101  return;
102 
103  if (this->desc)
104  {
105  for (std::set<unsigned>::reverse_iterator it = numbers.rbegin(), it_end = numbers.rend(); it != it_end; ++it)
106  this->HandleNumber(*it);
107  }
108  else
109  {
110  for (std::set<unsigned>::iterator it = numbers.begin(), it_end = numbers.end(); it != it_end; ++it)
111  this->HandleNumber(*it);
112  }
113 }
114 
116 {
117 }
118 
120 {
121  return true;
122 }
123 
125 {
126 }
127 
129 {
130  this->columns.push_back(name);
131  return *this;
132 }
133 
135 {
136  this->entries.push_back(entry);
137 }
138 
140 {
141  return this->entries.empty();
142 }
143 
144 void ListFormatter::Process(std::vector<Anope::string> &buffer)
145 {
146  std::vector<Anope::string> tcolumns;
147  std::map<Anope::string, size_t> lenghts;
148  std::set<Anope::string> breaks;
149  for (unsigned i = 0; i < this->columns.size(); ++i)
150  {
151  tcolumns.push_back(Language::Translate(this->nc, this->columns[i].c_str()));
152  lenghts[this->columns[i]] = tcolumns[i].length();
153  }
154  for (unsigned i = 0; i < this->entries.size(); ++i)
155  {
156  ListEntry &e = this->entries[i];
157  for (unsigned j = 0; j < this->columns.size(); ++j)
158  if (e[this->columns[j]].length() > lenghts[this->columns[j]])
159  lenghts[this->columns[j]] = e[this->columns[j]].length();
160  }
161  unsigned length = 0;
162  for (std::map<Anope::string, size_t>::iterator it = lenghts.begin(), it_end = lenghts.end(); it != it_end; ++it)
163  {
164  /* Break lines at 80 chars */
165  if (length > 80)
166  {
167  breaks.insert(it->first);
168  length = 0;
169  }
170  else
171  length += it->second;
172  }
173 
174  /* Only put a list header if more than 1 column */
175  if (this->columns.size() > 1)
176  {
177  Anope::string s;
178  for (unsigned i = 0; i < this->columns.size(); ++i)
179  {
180  if (breaks.count(this->columns[i]))
181  {
182  buffer.push_back(s);
183  s = " ";
184  }
185  else if (!s.empty())
186  s += " ";
187  s += tcolumns[i];
188  if (i + 1 != this->columns.size())
189  for (unsigned j = tcolumns[i].length(); j < lenghts[this->columns[i]]; ++j)
190  s += " ";
191  }
192  buffer.push_back(s);
193  }
194 
195  for (unsigned i = 0; i < this->entries.size(); ++i)
196  {
197  ListEntry &e = this->entries[i];
198 
199  Anope::string s;
200  for (unsigned j = 0; j < this->columns.size(); ++j)
201  {
202  if (breaks.count(this->columns[j]))
203  {
204  buffer.push_back(s);
205  s = " ";
206  }
207  else if (!s.empty())
208  s += " ";
209  s += e[this->columns[j]];
210  if (j + 1 != this->columns.size())
211  for (unsigned k = e[this->columns[j]].length(); k < lenghts[this->columns[j]]; ++k)
212  s += " ";
213  }
214  buffer.push_back(s);
215  }
216 }
217 
218 InfoFormatter::InfoFormatter(NickCore *acc) : nc(acc), longest(0)
219 {
220 }
221 
222 void InfoFormatter::Process(std::vector<Anope::string> &buffer)
223 {
224  buffer.clear();
225 
226  for (std::vector<std::pair<Anope::string, Anope::string> >::iterator it = this->replies.begin(), it_end = this->replies.end(); it != it_end; ++it)
227  {
228  Anope::string s;
229  for (unsigned i = it->first.length(); i < this->longest; ++i)
230  s += " ";
231  s += it->first + ": " + Language::Translate(this->nc, it->second.c_str());
232 
233  buffer.push_back(s);
234  }
235 }
236 
238 {
239  Anope::string tkey = Language::Translate(this->nc, key.c_str());
240  if (tkey.length() > this->longest)
241  this->longest = tkey.length();
242  this->replies.push_back(std::make_pair(tkey, ""));
243  return this->replies.back().second;
244 }
245 
247 {
248  Anope::string options = Language::Translate(this->nc, "Options");
249  Anope::string *optstr = NULL;
250  for (std::vector<std::pair<Anope::string, Anope::string> >::iterator it = this->replies.begin(), it_end = this->replies.end(); it != it_end; ++it)
251  {
252  if (it->first == options)
253  {
254  optstr = &it->second;
255  break;
256  }
257  }
258  if (!optstr)
259  optstr = &(*this)[_("Options")];
260 
261  if (!optstr->empty())
262  *optstr += ", ";
263  *optstr += Language::Translate(nc, opt.c_str());
264 }
265 
266 bool Anope::IsFile(const Anope::string &filename)
267 {
268  struct stat fileinfo;
269  if (!stat(filename.c_str(), &fileinfo))
270  return true;
271 
272  return false;
273 }
274 
275 time_t Anope::DoTime(const Anope::string &s)
276 {
277  if (s.empty())
278  return 0;
279 
280  int amount = 0;
281  Anope::string end;
282 
283  try
284  {
285  amount = convertTo<int>(s, end, false);
286  if (!end.empty())
287  {
288  switch (end[0])
289  {
290  case 's':
291  return amount;
292  case 'm':
293  return amount * 60;
294  case 'h':
295  return amount * 3600;
296  case 'd':
297  return amount * 86400;
298  case 'w':
299  return amount * 86400 * 7;
300  case 'y':
301  return amount * 86400 * 365;
302  default:
303  break;
304  }
305  }
306  }
307  catch (const ConvertException &)
308  {
309  amount = -1;
310  }
311 
312  return amount;
313 }
314 
316 {
317  /* We first calculate everything */
318  time_t years = t / 31536000;
319  time_t days = (t / 86400) % 365;
320  time_t hours = (t / 3600) % 24;
321  time_t minutes = (t / 60) % 60;
322  time_t seconds = (t) % 60;
323 
324  if (!days && !hours && !minutes)
325  return stringify(seconds) + " " + (seconds != 1 ? Language::Translate(nc, _("seconds")) : Language::Translate(nc, _("second")));
326  else
327  {
328  bool need_comma = false;
329  Anope::string buffer;
330  if (years)
331  {
332  buffer = stringify(years) + " " + (years != 1 ? Language::Translate(nc, _("years")) : Language::Translate(nc, _("year")));
333  need_comma = true;
334  }
335  if (days)
336  {
337  buffer += need_comma ? ", " : "";
338  buffer += stringify(days) + " " + (days != 1 ? Language::Translate(nc, _("days")) : Language::Translate(nc, _("day")));
339  need_comma = true;
340  }
341  if (hours)
342  {
343  buffer += need_comma ? ", " : "";
344  buffer += stringify(hours) + " " + (hours != 1 ? Language::Translate(nc, _("hours")) : Language::Translate(nc, _("hour")));
345  need_comma = true;
346  }
347  if (minutes)
348  {
349  buffer += need_comma ? ", " : "";
350  buffer += stringify(minutes) + " " + (minutes != 1 ? Language::Translate(nc, _("minutes")) : Language::Translate(nc, _("minute")));
351  }
352  return buffer;
353  }
354 }
355 
356 Anope::string Anope::strftime(time_t t, const NickCore *nc, bool short_output)
357 {
358  tm tm = *localtime(&t);
359  char buf[BUFSIZE];
360  strftime(buf, sizeof(buf), Language::Translate(nc, _("%b %d %H:%M:%S %Y %Z")), &tm);
361  if (short_output)
362  return buf;
363  if (t < Anope::CurTime)
364  return Anope::string(buf) + " " + Anope::printf(Language::Translate(nc, _("(%s ago)")), Duration(Anope::CurTime - t, nc).c_str(), nc);
365  else if (t > Anope::CurTime)
366  return Anope::string(buf) + " " + Anope::printf(Language::Translate(nc, _("(%s from now)")), Duration(t - Anope::CurTime, nc).c_str(), nc);
367  else
368  return Anope::string(buf) + " " + Language::Translate(nc, _("(now)"));
369 }
370 
371 Anope::string Anope::Expires(time_t expires, const NickCore *nc)
372 {
373  if (!expires)
374  return Language::Translate(nc, NO_EXPIRE);
375  else if (expires <= Anope::CurTime)
376  return Language::Translate(nc, _("expires momentarily"));
377  else
378  {
379  char buf[256];
380  time_t diff = expires - Anope::CurTime + 59;
381 
382  if (diff >= 86400)
383  {
384  int days = diff / 86400;
385  snprintf(buf, sizeof(buf), Language::Translate(nc, days == 1 ? _("expires in %d day") : _("expires in %d days")), days);
386  }
387  else
388  {
389  if (diff <= 3600)
390  {
391  int minutes = diff / 60;
392  snprintf(buf, sizeof(buf), Language::Translate(nc, minutes == 1 ? _("expires in %d minute") : _("expires in %d minutes")), minutes);
393  }
394  else
395  {
396  int hours = diff / 3600, minutes;
397  diff -= hours * 3600;
398  minutes = diff / 60;
399  snprintf(buf, sizeof(buf), Language::Translate(nc, hours == 1 && minutes == 1 ? _("expires in %d hour, %d minute") : (hours == 1 && minutes != 1 ? _("expires in %d hour, %d minutes") : (hours != 1 && minutes == 1 ? _("expires in %d hours, %d minute") : _("expires in %d hours, %d minutes")))), hours, minutes);
400  }
401  }
402 
403  return buf;
404  }
405 }
406 
407 bool Anope::Match(const Anope::string &str, const Anope::string &mask, bool case_sensitive, bool use_regex)
408 {
409  size_t s = 0, m = 0, str_len = str.length(), mask_len = mask.length();
410 
411  if (use_regex && mask_len >= 2 && mask[0] == '/' && mask[mask.length() - 1] == '/')
412  {
413  Anope::string stripped_mask = mask.substr(1, mask_len - 2);
414  // This is often called with the same mask multiple times in a row, so cache it
415  static Regex *r = NULL;
416 
417  if (r == NULL || r->GetExpression() != stripped_mask)
418  {
419  ServiceReference<RegexProvider> provider("Regex", Config->GetBlock("options")->Get<const Anope::string>("regexengine"));
420  if (provider)
421  {
422  try
423  {
424  delete r;
425  r = NULL;
426  // This may throw
427  r = provider->Compile(stripped_mask);
428  }
429  catch (const RegexException &ex)
430  {
431  Log(LOG_DEBUG) << ex.GetReason();
432  }
433  }
434  else
435  {
436  delete r;
437  r = NULL;
438  }
439  }
440 
441  if (r != NULL && r->Matches(str))
442  return true;
443 
444  // Fall through to non regex match
445  }
446 
447  while (s < str_len && m < mask_len && mask[m] != '*')
448  {
449  char string = str[s], wild = mask[m];
450  if (case_sensitive)
451  {
452  if (wild != string && wild != '?')
453  return false;
454  }
455  else
456  {
457  if (Anope::tolower(wild) != Anope::tolower(string) && wild != '?')
458  return false;
459  }
460 
461  ++m;
462  ++s;
463  }
464 
465  size_t sp = Anope::string::npos, mp = Anope::string::npos;
466  while (s < str_len)
467  {
468  char string = str[s], wild = mask[m];
469  if (wild == '*')
470  {
471  if (++m == mask_len)
472  return 1;
473 
474  mp = m;
475  sp = s + 1;
476  }
477  else if (case_sensitive)
478  {
479  if (wild == string || wild == '?')
480  {
481  ++m;
482  ++s;
483  }
484  else
485  {
486  m = mp;
487  s = sp++;
488  }
489  }
490  else
491  {
492  if (Anope::tolower(wild) == Anope::tolower(string) || wild == '?')
493  {
494  ++m;
495  ++s;
496  }
497  else
498  {
499  m = mp;
500  s = sp++;
501  }
502  }
503  }
504 
505  if (m < mask_len && mask[m] == '*')
506  ++m;
507 
508  return m == mask_len;
509 }
510 
512 {
513  EventReturn MOD_RESULT;
514  FOREACH_RESULT(OnEncrypt, MOD_RESULT, (src, dest));
515  static_cast<void>(MOD_RESULT);
516 }
517 
519 {
520  size_t pos = src.find(':');
521  if (pos == Anope::string::npos)
522  {
523  Log() << "Error: Anope::Decrypt() called with invalid password string (" << src << ")";
524  return false;
525  }
526  Anope::string hashm(src.begin(), src.begin() + pos);
527 
528  EventReturn MOD_RESULT;
529  FOREACH_RESULT(OnDecrypt, MOD_RESULT, (hashm, src, dest));
530  if (MOD_RESULT == EVENT_ALLOW)
531  return true;
532 
533  return false;
534 }
535 
536 Anope::string Anope::printf(const char *fmt, ...)
537 {
538  va_list args;
539  char buf[1024];
540  va_start(args, fmt);
541  vsnprintf(buf, sizeof(buf), fmt, args);
542  va_end(args);
543  return buf;
544 }
545 
547 {
548  const char hextable[] = "0123456789abcdef";
549 
550  size_t l = data.length();
551  Anope::string rv;
552  for (size_t i = 0; i < l; ++i)
553  {
554  unsigned char c = data[i];
555  rv += hextable[c >> 4];
556  rv += hextable[c & 0xF];
557  }
558  return rv;
559 }
560 
561 Anope::string Anope::Hex(const char *data, unsigned len)
562 {
563  const char hextable[] = "0123456789abcdef";
564 
565  Anope::string rv;
566  for (size_t i = 0; i < len; ++i)
567  {
568  unsigned char c = data[i];
569  rv += hextable[c >> 4];
570  rv += hextable[c & 0xF];
571  }
572  return rv;
573 }
574 
575 void Anope::Unhex(const Anope::string &src, Anope::string &dest)
576 {
577  size_t len = src.length();
578  Anope::string rv;
579  for (size_t i = 0; i + 1 < len; i += 2)
580  {
581  char h = Anope::tolower(src[i]), l = Anope::tolower(src[i + 1]);
582  unsigned char byte = (h >= 'a' ? h - 'a' + 10 : h - '0') << 4;
583  byte += (l >= 'a' ? l - 'a' + 10 : l - '0');
584  rv += byte;
585  }
586  dest = rv;
587 }
588 
589 void Anope::Unhex(const Anope::string &src, char *dest, size_t sz)
590 {
591  Anope::string d;
592  Anope::Unhex(src, d);
593 
594  memcpy(dest, d.c_str(), std::min(d.length() + 1, sz));
595 }
596 
598 {
599 #ifndef _WIN32
600  return errno;
601 #else
602  return GetLastError();
603 #endif
604 }
605 
607 {
608 #ifndef _WIN32
609  return strerror(errno);
610 #else
611  char errbuf[513];
612  DWORD err = GetLastError();
613  if (!err)
614  return "";
615  FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, errbuf, 512, NULL);
616  return errbuf;
617 #endif
618 }
619 
621 {
622  return ModuleVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
623 }
624 
626 {
627 #ifdef VERSION_GIT
628  return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH) + VERSION_EXTRA + " (" + VERSION_GIT + ")";
629 #else
630  return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH) + VERSION_EXTRA;
631 #endif
632 }
633 
635 {
636  return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH);
637 }
638 
640 {
641  Anope::string s = "build #" + stringify(BUILD) + ", compiled " + Anope::compiled;
642  Anope::string flags;
643 
644 #ifdef DEBUG_BUILD
645  flags += "D";
646 #endif
647 #ifdef VERSION_GIT
648  flags += "G";
649 #endif
650 #ifdef _WIN32
651  flags += "W";
652 #endif
653 
654  if (!flags.empty())
655  s += ", flags " + flags;
656 
657  return s;
658 }
659 
660 int Anope::VersionMajor() { return VERSION_MAJOR; }
661 int Anope::VersionMinor() { return VERSION_MINOR; }
662 int Anope::VersionPatch() { return VERSION_PATCH; }
663 
665 {
666  Anope::string newbuf;
667 
668  for (unsigned i = 0, end = buf.length(); i < end; ++i)
669  {
670  switch (buf[i])
671  {
672  /* ctrl char */
673  case 1:
674  /* Bold ctrl char */
675  case 2:
676  break;
677  /* Color ctrl char */
678  case 3:
679  /* If the next character is a digit, its also removed */
680  if (isdigit(buf[i + 1]))
681  {
682  ++i;
683 
684  /* not the best way to remove colors
685  * which are two digit but no worse then
686  * how the Unreal does with +S - TSL
687  */
688  if (isdigit(buf[i + 1]))
689  ++i;
690 
691  /* Check for background color code
692  * and remove it as well
693  */
694  if (buf[i + 1] == ',')
695  {
696  ++i;
697 
698  if (isdigit(buf[i + 1]))
699  ++i;
700  /* not the best way to remove colors
701  * which are two digit but no worse then
702  * how the Unreal does with +S - TSL
703  */
704  if (isdigit(buf[i + 1]))
705  ++i;
706  }
707  }
708 
709  break;
710  /* line feed char */
711  case 10:
712  /* carriage returns char */
713  case 13:
714  /* Reverse ctrl char */
715  case 22:
716  /* Italic ctrl char */
717  case 29:
718  /* Underline ctrl char */
719  case 31:
720  break;
721  /* A valid char gets copied into the new buffer */
722  default:
723  newbuf += buf[i];
724  }
725  }
726 
727  return newbuf;
728 }
729 
731 {
732  Anope::string result = host;
733 
734  addrinfo hints;
735  memset(&hints, 0, sizeof(hints));
736  hints.ai_family = type;
737 
738  Log(LOG_DEBUG_2) << "Resolver: BlockingQuery: Looking up " << host;
739 
740  addrinfo *addrresult = NULL;
741  if (getaddrinfo(host.c_str(), NULL, &hints, &addrresult) == 0)
742  {
743  sockaddrs addr;
744  memcpy(&addr, addrresult->ai_addr, addrresult->ai_addrlen);
745  result = addr.addr();
746  Log(LOG_DEBUG_2) << "Resolver: " << host << " -> " << result;
747 
748  freeaddrinfo(addrresult);
749  }
750 
751  return result;
752 }
753 
755 {
756  char chars[] = {
757  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
758  'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
759  'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
760  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
761  'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
762  };
763  Anope::string buf;
764  for (size_t i = 0; i < len; ++i)
765  buf.append(chars[rand() % sizeof(chars)]);
766  return buf;
767 }
768 
NumberList(const Anope::string &list, bool descending)
Definition: misc.cpp:31
void AddOption(const Anope::string &opt)
Definition: misc.cpp:246
ModuleVersion GetVersion() const
Definition: misc.cpp:620
string & append(const string &s)
Definition: anope.h:144
Anope::string desc
Definition: access.cpp:23
void push_back(char c)
Definition: anope.h:142
CoreExport string Version()
Definition: misc.cpp:625
CoreExport const string LastError()
Definition: misc.cpp:606
CoreExport bool IsFile(const Anope::string &file)
Definition: misc.cpp:266
virtual ~NumberList()
Definition: misc.cpp:94
Anope::string addr() const
Definition: sockets.cpp:73
CoreExport string printf(const char *fmt,...)
Definition: misc.cpp:536
void Process(std::vector< Anope::string > &)
Definition: misc.cpp:144
#define BUFSIZE
Definition: services.h:18
void AddEntry(const ListEntry &entry)
Definition: misc.cpp:134
#define NO_EXPIRE
Definition: language.h:89
unsigned longest
Definition: lists.h:87
CoreExport int LastErrorCode()
Definition: misc.cpp:597
const Anope::string & GetExpression()
Definition: regexpr.h:35
void Process(std::vector< Anope::string > &)
Definition: misc.cpp:222
#define FOREACH_RESULT(ename, ret, args)
Definition: modules.h:95
NickCore * nc
Definition: lists.h:85
virtual void HandleNumber(unsigned number)
Definition: misc.cpp:115
std::vector< std::pair< Anope::string, Anope::string > > replies
Definition: lists.h:86
CoreExport time_t CurTime
Definition: main.cpp:41
InfoFormatter(NickCore *nc)
Definition: misc.cpp:218
CoreExport string Hex(const string &data)
Definition: misc.cpp:546
Definition: regexpr.h:28
std::vector< ListEntry > entries
Definition: lists.h:72
string substr(size_type pos=0, size_type n=npos) const
Definition: anope.h:277
unsigned char tolower(unsigned char)
Definition: hashcomp.cpp:31
std::map< Anope::string, Anope::string > ListEntry
Definition: lists.h:68
CoreExport bool Decrypt(const Anope::string &src, Anope::string &dest)
Definition: misc.cpp:518
size_type length() const
Definition: anope.h:131
Definition: Config.cs:26
bool desc
Definition: lists.h:33
CoreExport bool Match(const string &str, const string &mask, bool case_sensitive=false, bool use_regex=false)
Definition: misc.cpp:407
CoreExport int VersionMajor()
Definition: misc.cpp:660
static const size_type npos
Definition: anope.h:44
bool IsEmpty() const
Definition: misc.cpp:139
CoreExport time_t DoTime(const Anope::string &s)
Definition: misc.cpp:275
NickCore * nc
Definition: lists.h:70
CoreExport string VersionShort()
Definition: misc.cpp:634
virtual bool InvalidRange(const Anope::string &list)
Definition: misc.cpp:119
CoreExport Anope::string NormalizeBuffer(const Anope::string &)
Definition: misc.cpp:664
bool empty() const
Definition: anope.h:126
virtual Regex * Compile(const Anope::string &)=0
std::basic_string< char, ci_char_traits, std::allocator< char > > string
Definition: hashcomp.h:133
EventReturn
Definition: modules.h:129
CoreExport Anope::string Random(size_t len)
Definition: misc.cpp:754
CoreExport const char * Translate(const char *string)
Definition: language.cpp:59
virtual bool Matches(const Anope::string &str)=0
CoreExport string VersionBuildString()
Definition: misc.cpp:639
void Process()
Definition: misc.cpp:98
Anope::string stringify(const T &x)
Definition: anope.h:710
Anope::string Resolve(const Anope::string &host, int type)
Definition: misc.cpp:730
bool GetToken(Anope::string &token)
Definition: hashcomp.cpp:99
static Anope::string hashm
Definition: db_old.cpp:123
Anope::string name
Definition: access.cpp:22
virtual const Anope::string & GetReason() const
Definition: anope.h:672
Anope::string & operator[](const Anope::string &key)
Definition: misc.cpp:237
CoreExport void Encrypt(const Anope::string &src, Anope::string &dest)
Definition: misc.cpp:511
std::vector< Anope::string > columns
Definition: lists.h:71
const char * c_str() const
Definition: anope.h:117
CoreExport int VersionPatch()
Definition: misc.cpp:662
Definition: logger.h:53
CoreExport Anope::string Duration(time_t seconds, const NickCore *nc=NULL)
Definition: misc.cpp:315
CoreExport int VersionMinor()
Definition: misc.cpp:661
CoreExport Anope::string strftime(time_t t, const NickCore *nc=NULL, bool short_output=false)
Definition: misc.cpp:356
bool is_valid
Definition: lists.h:29
ListFormatter(NickCore *nc)
Definition: misc.cpp:124
iterator begin()
Definition: anope.h:282
static const char *const compiled
Definition: anope.h:340
size_type find(const string &_str, size_type pos=0) const
Definition: anope.h:192
#define _(x)
Definition: services.h:50
CoreExport Anope::string Expires(time_t seconds, const NickCore *nc=NULL)
Definition: misc.cpp:371
ListFormatter & AddColumn(const Anope::string &name)
Definition: misc.cpp:128
CoreExport void Unhex(const string &src, string &dest)
Definition: misc.cpp:575
std::set< unsigned > numbers
Definition: lists.h:31