Anope IRC Services  Version 2.0
db_old.cpp
Go to the documentation of this file.
1 /*
2  * (C) 2003-2014 Anope Team
3  * Contact us at team@anope.org
4  *
5  * Please read COPYING and README for further details.
6  *
7  * Based on the original code of Epona by Lara.
8  * Based on the original code of Services by Andy Church.
9  */
10 
11 #include "module.h"
12 #include "modules/os_session.h"
13 #include "modules/bs_kick.h"
14 #include "modules/cs_mode.h"
15 #include "modules/bs_badwords.h"
16 #include "modules/os_news.h"
17 #include "modules/suspend.h"
18 #include "modules/os_forbid.h"
19 #include "modules/cs_entrymsg.h"
20 
21 #define READ(x) \
22 if (true) \
23 { \
24  if ((x) < 0) \
25  printf("Error, the database is broken, line %d, trying to continue... no guarantee.\n", __LINE__); \
26 } \
27 else \
28  static_cast<void>(0)
29 
30 #define getc_db(f) (fgetc((f)->fp))
31 #define read_db(f, buf, len) (fread((buf), 1, (len), (f)->fp))
32 #define read_buffer(buf, f) (read_db((f), (buf), sizeof(buf)) == sizeof(buf))
33 
34 #define OLD_BI_PRIVATE 0x0001
35 
36 #define OLD_NI_KILLPROTECT 0x00000001 /* Kill others who take this nick */
37 #define OLD_NI_SECURE 0x00000002 /* Don't recognize unless IDENTIFY'd */
38 #define OLD_NI_MSG 0x00000004 /* Use PRIVMSGs instead of NOTICEs */
39 #define OLD_NI_MEMO_HARDMAX 0x00000008 /* Don't allow user to change memo limit */
40 #define OLD_NI_MEMO_SIGNON 0x00000010 /* Notify of memos at signon and un-away */
41 #define OLD_NI_MEMO_RECEIVE 0x00000020 /* Notify of new memos when sent */
42 #define OLD_NI_PRIVATE 0x00000040 /* Don't show in LIST to non-servadmins */
43 #define OLD_NI_HIDE_EMAIL 0x00000080 /* Don't show E-mail in INFO */
44 #define OLD_NI_HIDE_MASK 0x00000100 /* Don't show last seen address in INFO */
45 #define OLD_NI_HIDE_QUIT 0x00000200 /* Don't show last quit message in INFO */
46 #define OLD_NI_KILL_QUICK 0x00000400 /* Kill in 20 seconds instead of 60 */
47 #define OLD_NI_KILL_IMMED 0x00000800 /* Kill immediately instead of in 60 sec */
48 #define OLD_NI_MEMO_MAIL 0x00010000 /* User gets email on memo */
49 #define OLD_NI_HIDE_STATUS 0x00020000 /* Don't show services access status */
50 #define OLD_NI_SUSPENDED 0x00040000 /* Nickname is suspended */
51 #define OLD_NI_AUTOOP 0x00080000 /* Autoop nickname in channels */
52 
53 #define OLD_NS_NO_EXPIRE 0x0004 /* nick won't expire */
54 #define OLD_NS_VERBOTEN 0x0002
55 
56 #define OLD_CI_KEEPTOPIC 0x00000001
57 #define OLD_CI_SECUREOPS 0x00000002
58 #define OLD_CI_PRIVATE 0x00000004
59 #define OLD_CI_TOPICLOCK 0x00000008
60 #define OLD_CI_RESTRICTED 0x00000010
61 #define OLD_CI_PEACE 0x00000020
62 #define OLD_CI_SECURE 0x00000040
63 #define OLD_CI_VERBOTEN 0x00000080
64 #define OLD_CI_ENCRYPTEDPW 0x00000100
65 #define OLD_CI_NO_EXPIRE 0x00000200
66 #define OLD_CI_MEMO_HARDMAX 0x00000400
67 #define OLD_CI_OPNOTICE 0x00000800
68 #define OLD_CI_SECUREFOUNDER 0x00001000
69 #define OLD_CI_SIGNKICK 0x00002000
70 #define OLD_CI_SIGNKICK_LEVEL 0x00004000
71 #define OLD_CI_XOP 0x00008000
72 #define OLD_CI_SUSPENDED 0x00010000
73 
74 /* BotServ SET flags */
75 #define OLD_BS_DONTKICKOPS 0x00000001
76 #define OLD_BS_DONTKICKVOICES 0x00000002
77 #define OLD_BS_FANTASY 0x00000004
78 #define OLD_BS_SYMBIOSIS 0x00000008
79 #define OLD_BS_GREET 0x00000010
80 #define OLD_BS_NOBOT 0x00000020
81 
82 /* BotServ Kickers flags */
83 #define OLD_BS_KICK_BOLDS 0x80000000
84 #define OLD_BS_KICK_COLORS 0x40000000
85 #define OLD_BS_KICK_REVERSES 0x20000000
86 #define OLD_BS_KICK_UNDERLINES 0x10000000
87 #define OLD_BS_KICK_BADWORDS 0x08000000
88 #define OLD_BS_KICK_CAPS 0x04000000
89 #define OLD_BS_KICK_FLOOD 0x02000000
90 #define OLD_BS_KICK_REPEAT 0x01000000
91 
92 #define OLD_NEWS_LOGON 0
93 #define OLD_NEWS_OPER 1
94 #define OLD_NEWS_RANDOM 2
95 
96 static struct mlock_info
97 {
98  char c;
99  uint32_t m;
100 } mlock_infos[] = {
101  {'i', 0x00000001},
102  {'m', 0x00000002},
103  {'n', 0x00000004},
104  {'p', 0x00000008},
105  {'s', 0x00000010},
106  {'t', 0x00000020},
107  {'R', 0x00000100},
108  {'r', 0x00000200},
109  {'c', 0x00000400},
110  {'A', 0x00000800},
111  {'K', 0x00002000},
112  {'O', 0x00008000},
113  {'Q', 0x00010000},
114  {'S', 0x00020000},
115  {'G', 0x00100000},
116  {'C', 0x00200000},
117  {'u', 0x00400000},
118  {'z', 0x00800000},
119  {'N', 0x01000000},
120  {'M', 0x04000000}
121 };
122 
124 
125 enum
126 {
127  LANG_EN_US, /* United States English */
128  LANG_JA_JIS, /* Japanese (JIS encoding) */
129  LANG_JA_EUC, /* Japanese (EUC encoding) */
130  LANG_JA_SJIS, /* Japanese (SJIS encoding) */
131  LANG_ES, /* Spanish */
132  LANG_PT, /* Portugese */
133  LANG_FR, /* French */
134  LANG_TR, /* Turkish */
135  LANG_IT, /* Italian */
136  LANG_DE, /* German */
137  LANG_CAT, /* Catalan */
138  LANG_GR, /* Greek */
139  LANG_NL, /* Dutch */
140  LANG_RU, /* Russian */
141  LANG_HUN, /* Hungarian */
142  LANG_PL /* Polish */
143 };
144 
145 static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status, uint32_t *limit, Anope::string *key)
146 {
147  ModeLocks *ml = ci->Require<ModeLocks>("modelocks");
148  for (unsigned i = 0; i < (sizeof(mlock_infos) / sizeof(mlock_info)); ++i)
149  if (lock & mlock_infos[i].m)
150  {
152  if (cm && ml)
153  {
154  if (limit && mlock_infos[i].c == 'l')
155  ml->SetMLock(cm, status, stringify(*limit));
156  else if (key && mlock_infos[i].c == 'k')
157  ml->SetMLock(cm, status, *key);
158  else
159  ml->SetMLock(cm, status);
160  }
161  }
162 }
163 
164 static const char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
165 static const char Pad64 = '=';
166 
167 static void my_b64_encode(const Anope::string &src, Anope::string &target)
168 {
169  size_t src_pos = 0, src_len = src.length();
170  unsigned char input[3];
171 
172  target.clear();
173 
174  while (src_len - src_pos > 2)
175  {
176  input[0] = src[src_pos++];
177  input[1] = src[src_pos++];
178  input[2] = src[src_pos++];
179 
180  target += Base64[input[0] >> 2];
181  target += Base64[((input[0] & 0x03) << 4) + (input[1] >> 4)];
182  target += Base64[((input[1] & 0x0f) << 2) + (input[2] >> 6)];
183  target += Base64[input[2] & 0x3f];
184  }
185 
186  /* Now we worry about padding */
187  if (src_pos != src_len)
188  {
189  input[0] = input[1] = input[2] = 0;
190  for (size_t i = 0; i < src_len - src_pos; ++i)
191  input[i] = src[src_pos + i];
192 
193  target += Base64[input[0] >> 2];
194  target += Base64[((input[0] & 0x03) << 4) + (input[1] >> 4)];
195  if (src_pos == src_len - 1)
196  target += Pad64;
197  else
198  target += Base64[((input[1] & 0x0f) << 2) + (input[2] >> 6)];
199  target += Pad64;
200  }
201 }
202 
203 static Anope::string Hex(const char *data, size_t l)
204 {
205  const char hextable[] = "0123456789abcdef";
206 
207  std::string rv;
208  for (size_t i = 0; i < l; ++i)
209  {
210  unsigned char c = data[i];
211  rv += hextable[c >> 4];
212  rv += hextable[c & 0xF];
213  }
214  return rv;
215 }
216 
217 static Anope::string GetLevelName(int level)
218 {
219  switch (level)
220  {
221  case 0:
222  return "INVITE";
223  case 1:
224  return "AKICK";
225  case 2:
226  return "SET";
227  case 3:
228  return "UNBAN";
229  case 4:
230  return "AUTOOP";
231  case 5:
232  return "AUTODEOP";
233  case 6:
234  return "AUTOVOICE";
235  case 7:
236  return "OP";
237  case 8:
238  return "ACCESS_LIST";
239  case 9:
240  return "CLEAR";
241  case 10:
242  return "NOJOIN";
243  case 11:
244  return "ACCESS_CHANGE";
245  case 12:
246  return "MEMO";
247  case 13:
248  return "ASSIGN";
249  case 14:
250  return "BADWORDS";
251  case 15:
252  return "NOKICK";
253  case 16:
254  return "FANTASIA";
255  case 17:
256  return "SAY";
257  case 18:
258  return "GREET";
259  case 19:
260  return "VOICEME";
261  case 20:
262  return "VOICE";
263  case 21:
264  return "GETKEY";
265  case 22:
266  return "AUTOHALFOP";
267  case 23:
268  return "AUTOPROTECT";
269  case 24:
270  return "OPME";
271  case 25:
272  return "HALFOPME";
273  case 26:
274  return "HALFOP";
275  case 27:
276  return "PROTECTME";
277  case 28:
278  return "PROTECT";
279  case 29:
280  return "KICKME";
281  case 30:
282  return "KICK";
283  case 31:
284  return "SIGNKICK";
285  case 32:
286  return "BANME";
287  case 33:
288  return "BAN";
289  case 34:
290  return "TOPIC";
291  case 35:
292  return "INFO";
293  default:
294  return "INVALID";
295  }
296 }
297 
298 static char *strscpy(char *d, const char *s, size_t len)
299 {
300  char *d_orig = d;
301 
302  if (!len)
303  return d;
304  while (--len && (*d++ = *s++));
305  *d = '\0';
306  return d_orig;
307 }
308 
309 struct dbFILE
310 {
311  int mode; /* 'r' for reading, 'w' for writing */
312  FILE *fp; /* The normal file descriptor */
313  char filename[1024]; /* Name of the database file */
314 };
315 
316 static dbFILE *open_db_read(const char *service, const char *filename, int version)
317 {
318  dbFILE *f;
319  FILE *fp;
320  int myversion;
321 
322  f = new dbFILE;
323  strscpy(f->filename, (Anope::DataDir + "/" + filename).c_str(), sizeof(f->filename));
324  f->mode = 'r';
325  fp = fopen(f->filename, "rb");
326  if (!fp)
327  {
328  Log() << "Can't read " << service << " database " << f->filename;
329  delete f;
330  return NULL;
331  }
332  f->fp = fp;
333  myversion = fgetc(fp) << 24 | fgetc(fp) << 16 | fgetc(fp) << 8 | fgetc(fp);
334  if (feof(fp))
335  {
336  Log() << "Error reading version number on " << f->filename << ": End of file detected.";
337  delete f;
338  return NULL;
339  }
340  else if (myversion < version)
341  {
342  Log() << "Unsuported database version (" << myversion << ") on " << f->filename << ".";
343  delete f;
344  return NULL;
345  }
346  return f;
347 }
348 
349 void close_db(dbFILE *f)
350 {
351  fclose(f->fp);
352  delete f;
353 }
354 
355 static int read_int16(int16_t *ret, dbFILE *f)
356 {
357  int c1, c2;
358 
359  *ret = 0;
360 
361  c1 = fgetc(f->fp);
362  c2 = fgetc(f->fp);
363  if (c1 == EOF || c2 == EOF)
364  return -1;
365  *ret = c1 << 8 | c2;
366  return 0;
367 }
368 
369 static int read_uint16(uint16_t *ret, dbFILE *f)
370 {
371  int c1, c2;
372 
373  *ret = 0;
374 
375  c1 = fgetc(f->fp);
376  c2 = fgetc(f->fp);
377  if (c1 == EOF || c2 == EOF)
378  return -1;
379  *ret = c1 << 8 | c2;
380  return 0;
381 }
382 
383 static int read_string(Anope::string &str, dbFILE *f)
384 {
385  str.clear();
386  uint16_t len;
387 
388  if (read_uint16(&len, f) < 0)
389  return -1;
390  if (len == 0)
391  return 0;
392  char *s = new char[len];
393  if (len != fread(s, 1, len, f->fp))
394  {
395  delete [] s;
396  return -1;
397  }
398  str = s;
399  delete [] s;
400  return 0;
401 }
402 
403 static int read_uint32(uint32_t *ret, dbFILE *f)
404 {
405  int c1, c2, c3, c4;
406 
407  *ret = 0;
408 
409  c1 = fgetc(f->fp);
410  c2 = fgetc(f->fp);
411  c3 = fgetc(f->fp);
412  c4 = fgetc(f->fp);
413  if (c1 == EOF || c2 == EOF || c3 == EOF || c4 == EOF)
414  return -1;
415  *ret = c1 << 24 | c2 << 16 | c3 << 8 | c4;
416  return 0;
417 }
418 
419 int read_int32(int32_t *ret, dbFILE *f)
420 {
421  int c1, c2, c3, c4;
422 
423  *ret = 0;
424 
425  c1 = fgetc(f->fp);
426  c2 = fgetc(f->fp);
427  c3 = fgetc(f->fp);
428  c4 = fgetc(f->fp);
429  if (c1 == EOF || c2 == EOF || c3 == EOF || c4 == EOF)
430  return -1;
431  *ret = c1 << 24 | c2 << 16 | c3 << 8 | c4;
432  return 0;
433 }
434 
435 static void LoadNicks()
436 {
437  ServiceReference<ForbidService> forbid("ForbidService", "forbid");
438  dbFILE *f = open_db_read("NickServ", "nick.db", 14);
439  if (f == NULL)
440  return;
441  for (int i = 0; i < 1024; ++i)
442  for (int c; (c = getc_db(f)) == 1;)
443  {
444  Anope::string buffer;
445 
446  READ(read_string(buffer, f));
447  NickCore *nc = new NickCore(buffer);
448 
449  const Anope::string settings[] = { "killprotect", "kill_quick", "ns_secure", "ns_private", "hide_email",
450  "hide_mask", "hide_quit", "memo_signon", "memo_receive", "autoop", "msg", "ns_keepmodes" };
451  for (unsigned j = 0; j < sizeof(settings) / sizeof(Anope::string); ++j)
452  nc->Shrink<bool>(settings[j].upper());
453 
454  char pwbuf[32];
455  READ(read_buffer(pwbuf, f));
456  if (hashm == "plain")
457  my_b64_encode(pwbuf, nc->pass);
458  else if (hashm == "md5" || hashm == "oldmd5")
459  nc->pass = Hex(pwbuf, 16);
460  else if (hashm == "sha1")
461  nc->pass = Hex(pwbuf, 20);
462  else
463  nc->pass = Hex(pwbuf, strlen(pwbuf));
464  nc->pass = hashm + ":" + nc->pass;
465 
466  READ(read_string(buffer, f));
467  nc->email = buffer;
468 
469  READ(read_string(buffer, f));
470  if (!buffer.empty())
471  nc->Extend<Anope::string>("greet", buffer);
472 
473  uint32_t u32;
474  READ(read_uint32(&u32, f));
475  //nc->icq = u32;
476 
477  READ(read_string(buffer, f));
478  //nc->url = buffer;
479 
480  READ(read_uint32(&u32, f));
481  if (u32 & OLD_NI_KILLPROTECT)
482  nc->Extend<bool>("KILLPROTECT");
483  if (u32 & OLD_NI_SECURE)
484  nc->Extend<bool>("NS_SECURE");
485  if (u32 & OLD_NI_MSG)
486  nc->Extend<bool>("MSG");
487  if (u32 & OLD_NI_MEMO_HARDMAX)
488  nc->Extend<bool>("MEMO_HARDMAX");
489  if (u32 & OLD_NI_MEMO_SIGNON)
490  nc->Extend<bool>("MEMO_SIGNON");
491  if (u32 & OLD_NI_MEMO_RECEIVE)
492  nc->Extend<bool>("MEMO_RECEIVE");
493  if (u32 & OLD_NI_PRIVATE)
494  nc->Extend<bool>("NS_PRIVATE");
495  if (u32 & OLD_NI_HIDE_EMAIL)
496  nc->Extend<bool>("HIDE_EMAIL");
497  if (u32 & OLD_NI_HIDE_MASK)
498  nc->Extend<bool>("HIDE_MASK");
499  if (u32 & OLD_NI_HIDE_QUIT)
500  nc->Extend<bool>("HIDE_QUIT");
501  if (u32 & OLD_NI_KILL_QUICK)
502  nc->Extend<bool>("KILL_QUICK");
503  if (u32 & OLD_NI_KILL_IMMED)
504  nc->Extend<bool>("KILL_IMMED");
505  if (u32 & OLD_NI_MEMO_MAIL)
506  nc->Extend<bool>("MEMO_MAIL");
507  if (u32 & OLD_NI_HIDE_STATUS)
508  nc->Extend<bool>("HIDE_STATUS");
509  if (u32 & OLD_NI_SUSPENDED)
510  {
511  SuspendInfo si;
512  si.what = nc->display;
513  si.when = si.expires = 0;
514  nc->Extend("NS_SUSPENDED", si);
515  }
516  if (!(u32 & OLD_NI_AUTOOP))
517  nc->Extend<bool>("AUTOOP");
518 
519  uint16_t u16;
520  READ(read_uint16(&u16, f));
521  switch (u16)
522  {
523  case LANG_ES:
524  nc->language = "es_ES";
525  break;
526  case LANG_PT:
527  nc->language = "pt_PT";
528  break;
529  case LANG_FR:
530  nc->language = "fr_FR";
531  break;
532  case LANG_TR:
533  nc->language = "tr_TR";
534  break;
535  case LANG_IT:
536  nc->language = "it_IT";
537  break;
538  case LANG_DE:
539  nc->language = "de_DE";
540  break;
541  case LANG_CAT:
542  nc->language = "ca_ES"; // yes, iso639 defines catalan as CA
543  break;
544  case LANG_GR:
545  nc->language = "el_GR";
546  break;
547  case LANG_NL:
548  nc->language = "nl_NL";
549  break;
550  case LANG_RU:
551  nc->language = "ru_RU";
552  break;
553  case LANG_HUN:
554  nc->language = "hu_HU";
555  break;
556  case LANG_PL:
557  nc->language = "pl_PL";
558  break;
559  case LANG_EN_US:
560  case LANG_JA_JIS:
561  case LANG_JA_EUC:
562  case LANG_JA_SJIS: // these seem to be unused
563  default:
564  nc->language = "en";
565  }
566 
567  READ(read_uint16(&u16, f));
568  for (uint16_t j = 0; j < u16; ++j)
569  {
570  READ(read_string(buffer, f));
571  nc->access.push_back(buffer);
572  }
573 
574  int16_t i16;
575  READ(read_int16(&i16, f));
576  READ(read_int16(&nc->memos.memomax, f));
577  for (int16_t j = 0; j < i16; ++j)
578  {
579  Memo *m = new Memo;
580  READ(read_uint32(&u32, f));
581  uint16_t flags;
582  READ(read_uint16(&flags, f));
583  int32_t tmp32;
584  READ(read_int32(&tmp32, f));
585  m->time = tmp32;
586  char sbuf[32];
587  READ(read_buffer(sbuf, f));
588  m->sender = sbuf;
589  READ(read_string(m->text, f));
590  m->owner = nc->display;
591  nc->memos.memos->push_back(m);
592  }
593  READ(read_uint16(&u16, f));
594  READ(read_int16(&i16, f));
595 
596  Log(LOG_DEBUG) << "Loaded NickCore " << nc->display;
597  }
598 
599  for (int i = 0; i < 1024; ++i)
600  for (int c; (c = getc_db(f)) == 1;)
601  {
602  Anope::string nick, last_usermask, last_realname, last_quit;
603  time_t time_registered, last_seen;
604 
605  READ(read_string(nick, f));
606  READ(read_string(last_usermask, f));
607  READ(read_string(last_realname, f));
608  READ(read_string(last_quit, f));
609 
610  int32_t tmp32;
611  READ(read_int32(&tmp32, f));
612  time_registered = tmp32;
613  READ(read_int32(&tmp32, f));
614  last_seen = tmp32;
615 
616  uint16_t tmpu16;
617  READ(read_uint16(&tmpu16, f));
618 
619  Anope::string core;
620  READ(read_string(core, f));
621  NickCore *nc = NickCore::Find(core);
622  if (nc == NULL)
623  {
624  Log() << "Skipping coreless nick " << nick << " with core " << core;
625  continue;
626  }
627 
628  if (tmpu16 & OLD_NS_VERBOTEN)
629  {
630  if (!forbid)
631  {
632  delete nc;
633  continue;
634  }
635 
636  if (nc->display.find_first_of("?*") != Anope::string::npos)
637  {
638  delete nc;
639  continue;
640  }
641 
642  ForbidData *d = forbid->CreateForbid();
643  d->mask = nc->display;
644  d->creator = last_usermask;
645  d->reason = last_realname;
646  d->expires = 0;
647  d->created = 0;
648  d->type = FT_NICK;
649  delete nc;
650  forbid->AddForbid(d);
651  continue;
652  }
653 
654  NickAlias *na = new NickAlias(nick, nc);
655  na->last_usermask = last_usermask;
656  na->last_realname = last_realname;
657  na->last_quit = last_quit;
658  na->time_registered = time_registered;
659  na->last_seen = last_seen;
660 
661  if (tmpu16 & OLD_NS_NO_EXPIRE)
662  na->Extend<bool>("NS_NO_EXPIRE");
663 
664  Log(LOG_DEBUG) << "Loaded NickAlias " << na->nick;
665  }
666 
667  close_db(f); /* End of section Ia */
668 }
669 
670 static void LoadVHosts()
671 {
672  dbFILE *f = open_db_read("HostServ", "hosts.db", 3);
673  if (f == NULL)
674  return;
675 
676  for (int c; (c = getc_db(f)) == 1;)
677  {
678  Anope::string nick, ident, host, creator;
679  int32_t vtime;
680 
681  READ(read_string(nick, f));
682  READ(read_string(ident, f));
683  READ(read_string(host, f));
684  READ(read_string(creator, f));
685  READ(read_int32(&vtime, f));
686 
687  NickAlias *na = NickAlias::Find(nick);
688  if (na == NULL)
689  {
690  Log() << "Removing vhost for nonexistant nick " << nick;
691  continue;
692  }
693 
694  na->SetVhost(ident, host, creator, vtime);
695 
696  Log() << "Loaded vhost for " << na->nick;
697  }
698 
699  close_db(f);
700 }
701 
702 static void LoadBots()
703 {
704  dbFILE *f = open_db_read("Botserv", "bot.db", 10);
705  if (f == NULL)
706  return;
707 
708  for (int c; (c = getc_db(f)) == 1;)
709  {
710  Anope::string nick, user, host, real;
711  int16_t flags, chancount;
712  int32_t created;
713 
714  READ(read_string(nick, f));
715  READ(read_string(user, f));
716  READ(read_string(host, f));
717  READ(read_string(real, f));
718  READ(read_int16(&flags, f));
719  READ(read_int32(&created, f));
720  READ(read_int16(&chancount, f));
721 
722  BotInfo *bi = BotInfo::Find(nick, true);
723  if (!bi)
724  bi = new BotInfo(nick, user, host, real);
725  bi->created = created;
726 
727  if (flags & OLD_BI_PRIVATE)
728  bi->oper_only = true;
729 
730  Log(LOG_DEBUG) << "Loaded bot " << bi->nick;
731  }
732 
733  close_db(f);
734 }
735 
736 static void LoadChannels()
737 {
738  ServiceReference<ForbidService> forbid("ForbidService", "forbid");
739  dbFILE *f = open_db_read("ChanServ", "chan.db", 16);
740  if (f == NULL)
741  return;
742 
743  for (int i = 0; i < 256; ++i)
744  for (int c; (c = getc_db(f)) == 1;)
745  {
746  Anope::string buffer;
747  char namebuf[64];
748  READ(read_buffer(namebuf, f));
749  ChannelInfo *ci = new ChannelInfo(namebuf);
750 
751  const Anope::string settings[] = { "keeptopic", "peace", "cs_private", "restricted", "cs_secure", "secureops", "securefounder",
752  "signkick", "signkick_level", "topiclock", "persist", "noautoop", "cs_keepmodes" };
753  for (unsigned j = 0; j < sizeof(settings) / sizeof(Anope::string); ++j)
754  ci->Shrink<bool>(settings[j].upper());
755 
756  READ(read_string(buffer, f));
757  ci->SetFounder(NickCore::Find(buffer));
758 
759  READ(read_string(buffer, f));
760  ci->SetSuccessor(NickCore::Find(buffer));
761 
762  char pwbuf[32];
763  READ(read_buffer(pwbuf, f));
764 
765  READ(read_string(ci->desc, f));
766  READ(read_string(buffer, f));
767  READ(read_string(buffer, f));
768 
769  int32_t tmp32;
770  READ(read_int32(&tmp32, f));
771  ci->time_registered = tmp32;
772 
773  READ(read_int32(&tmp32, f));
774  ci->last_used = tmp32;
775 
776  READ(read_string(ci->last_topic, f));
777 
778  READ(read_buffer(pwbuf, f));
779  ci->last_topic_setter = pwbuf;
780 
781  READ(read_int32(&tmp32, f));
782  ci->last_topic_time = tmp32;
783 
784  uint32_t tmpu32;
785  READ(read_uint32(&tmpu32, f));
786  // Temporary flags cleanup
787  tmpu32 &= ~0x80000000;
788  if (tmpu32 & OLD_CI_KEEPTOPIC)
789  ci->Extend<bool>("KEEPTOPIC");
790  if (tmpu32 & OLD_CI_SECUREOPS)
791  ci->Extend<bool>("SECUREOPS");
792  if (tmpu32 & OLD_CI_PRIVATE)
793  ci->Extend<bool>("CS_PRIVATE");
794  if (tmpu32 & OLD_CI_TOPICLOCK)
795  ci->Extend<bool>("TOPICLOCK");
796  if (tmpu32 & OLD_CI_RESTRICTED)
797  ci->Extend<bool>("RESTRICTED");
798  if (tmpu32 & OLD_CI_PEACE)
799  ci->Extend<bool>("PEACE");
800  if (tmpu32 & OLD_CI_SECURE)
801  ci->Extend<bool>("CS_SECURE");
802  if (tmpu32 & OLD_CI_NO_EXPIRE)
803  ci->Extend<bool>("CS_NO_EXPIRE");
804  if (tmpu32 & OLD_CI_MEMO_HARDMAX)
805  ci->Extend<bool>("MEMO_HARDMAX");
806  if (tmpu32 & OLD_CI_SECUREFOUNDER)
807  ci->Extend<bool>("SECUREFOUNDER");
808  if (tmpu32 & OLD_CI_SIGNKICK)
809  ci->Extend<bool>("SIGNKICK");
810  if (tmpu32 & OLD_CI_SIGNKICK_LEVEL)
811  ci->Extend<bool>("SIGNKICK_LEVEL");
812 
813  Anope::string forbidby, forbidreason;
814  READ(read_string(forbidby, f));
815  READ(read_string(forbidreason, f));
816  if (tmpu32 & OLD_CI_SUSPENDED)
817  {
818  SuspendInfo si;
819  si.what = ci->name;
820  si.by = forbidby;
821  si.reason = forbidreason;
822  si.when = si.expires = 0;
823  ci->Extend("CS_SUSPENDED", si);
824  }
825  bool forbid_chan = tmpu32 & OLD_CI_VERBOTEN;
826 
827  int16_t tmp16;
828  READ(read_int16(&tmp16, f));
829  ci->bantype = tmp16;
830 
831  READ(read_int16(&tmp16, f));
832  if (tmp16 > 36)
833  tmp16 = 36;
834  for (int16_t j = 0; j < tmp16; ++j)
835  {
836  int16_t level;
837  READ(read_int16(&level, f));
838 
839  if (level == ACCESS_INVALID)
840  level = ACCESS_FOUNDER;
841 
842  if (j == 10 && level < 0) // NOJOIN
843  ci->Shrink<bool>("RESTRICTED"); // If CSDefRestricted was enabled this can happen
844 
845  ci->SetLevel(GetLevelName(j), level);
846  }
847 
848  bool xop = tmpu32 & OLD_CI_XOP;
849  ServiceReference<AccessProvider> provider_access("AccessProvider", "access/access"), provider_xop("AccessProvider", "access/xop");
850  uint16_t tmpu16;
851  READ(read_uint16(&tmpu16, f));
852  for (uint16_t j = 0; j < tmpu16; ++j)
853  {
854  uint16_t in_use;
855  READ(read_uint16(&in_use, f));
856  if (in_use)
857  {
858  ChanAccess *access = NULL;
859 
860  if (xop)
861  {
862  if (provider_xop)
863  access = provider_xop->Create();
864  }
865  else
866  if (provider_access)
867  access = provider_access->Create();
868 
869  if (access)
870  access->ci = ci;
871 
872  int16_t level;
873  READ(read_int16(&level, f));
874  if (access)
875  {
876  if (xop)
877  {
878  switch (level)
879  {
880  case 3:
881  access->AccessUnserialize("VOP");
882  break;
883  case 4:
884  access->AccessUnserialize("HOP");
885  break;
886  case 5:
887  access->AccessUnserialize("AOP");
888  break;
889  case 10:
890  access->AccessUnserialize("SOP");
891  break;
892  }
893  }
894  else
895  access->AccessUnserialize(stringify(level));
896  }
897 
898  Anope::string mask;
899  READ(read_string(mask, f));
900  if (access)
901  access->SetMask(mask, ci);
902 
903  READ(read_int32(&tmp32, f));
904  if (access)
905  {
906  access->last_seen = tmp32;
907  access->creator = "Unknown";
908  access->created = Anope::CurTime;
909 
910  ci->AddAccess(access);
911  }
912  }
913  }
914 
915  READ(read_uint16(&tmpu16, f));
916  for (uint16_t j = 0; j < tmpu16; ++j)
917  {
918  uint16_t flags;
919  READ(read_uint16(&flags, f));
920  if (flags & 0x0001)
921  {
922  Anope::string mask, reason, creator;
923  READ(read_string(mask, f));
924  READ(read_string(reason, f));
925  READ(read_string(creator, f));
926  READ(read_int32(&tmp32, f));
927 
928  ci->AddAkick(creator, mask, reason, tmp32);
929  }
930  }
931 
932  READ(read_uint32(&tmpu32, f)); // mlock on
933  ci->Extend<uint32_t>("mlock_on", tmpu32);
934  READ(read_uint32(&tmpu32, f)); // mlock off
935  ci->Extend<uint32_t>("mlock_off", tmpu32);
936  READ(read_uint32(&tmpu32, f)); // mlock limit
937  ci->Extend<uint32_t>("mlock_limit", tmpu32);
938  READ(read_string(buffer, f)); // key
939  ci->Extend<Anope::string>("mlock_key", buffer);
940  READ(read_string(buffer, f)); // +f
941  READ(read_string(buffer, f)); // +L
942 
943  READ(read_int16(&tmp16, f));
944  READ(read_int16(&ci->memos.memomax, f));
945  for (int16_t j = 0; j < tmp16; ++j)
946  {
947  READ(read_uint32(&tmpu32, f));
948  READ(read_uint16(&tmpu16, f));
949  Memo *m = new Memo;
950  READ(read_int32(&tmp32, f));
951  m->time = tmp32;
952  char sbuf[32];
953  READ(read_buffer(sbuf, f));
954  m->sender = sbuf;
955  READ(read_string(m->text, f));
956  m->owner = ci->name;
957  ci->memos.memos->push_back(m);
958  }
959 
960  READ(read_string(buffer, f));
961  if (!buffer.empty())
962  {
963  EntryMessageList *eml = ci->Require<EntryMessageList>("entrymsg");
964  if (eml)
965  {
966  EntryMsg *e = eml->Create();
967 
968  e->chan = ci->name;
969  e->creator = "Unknown";
970  e->message = buffer;
971  e->when = Anope::CurTime;
972 
973  (*eml)->push_back(e);
974  }
975  }
976 
977  READ(read_string(buffer, f));
978  ci->bi = BotInfo::Find(buffer, true);
979 
980  READ(read_int32(&tmp32, f));
981  if (tmp32 & OLD_BS_DONTKICKOPS)
982  ci->Extend<bool>("BS_DONTKICKOPS");
983  if (tmp32 & OLD_BS_DONTKICKVOICES)
984  ci->Extend<bool>("BS_DONTKICKVOICES");
985  if (tmp32 & OLD_BS_FANTASY)
986  ci->Extend<bool>("BS_FANTASY");
987  if (tmp32 & OLD_BS_GREET)
988  ci->Extend<bool>("BS_GREET");
989  if (tmp32 & OLD_BS_NOBOT)
990  ci->Extend<bool>("BS_NOBOT");
991 
992  KickerData *kd = ci->Require<KickerData>("kickerdata");
993  if (kd)
994  {
995  if (tmp32 & OLD_BS_KICK_BOLDS)
996  kd->bolds = true;
997  if (tmp32 & OLD_BS_KICK_COLORS)
998  kd->colors = true;
999  if (tmp32 & OLD_BS_KICK_REVERSES)
1000  kd->reverses = true;
1001  if (tmp32 & OLD_BS_KICK_UNDERLINES)
1002  kd->underlines = true;
1003  if (tmp32 & OLD_BS_KICK_BADWORDS)
1004  kd->badwords = true;
1005  if (tmp32 & OLD_BS_KICK_CAPS)
1006  kd->caps = true;
1007  if (tmp32 & OLD_BS_KICK_FLOOD)
1008  kd->flood = true;
1009  if (tmp32 & OLD_BS_KICK_REPEAT)
1010  kd->repeat = true;
1011  }
1012 
1013  READ(read_int16(&tmp16, f));
1014  for (int16_t j = 0; j < tmp16; ++j)
1015  {
1016  int16_t ttb;
1017  READ(read_int16(&ttb, f));
1018  if (j < TTB_SIZE && kd)
1019  kd->ttb[j] = ttb;
1020  }
1021 
1022  READ(read_int16(&tmp16, f));
1023  if (kd)
1024  kd->capsmin = tmp16;
1025  READ(read_int16(&tmp16, f));
1026  if (kd)
1027  kd->capspercent = tmp16;
1028  READ(read_int16(&tmp16, f));
1029  if (kd)
1030  kd->floodlines = tmp16;
1031  READ(read_int16(&tmp16, f));
1032  if (kd)
1033  kd->floodsecs = tmp16;
1034  READ(read_int16(&tmp16, f));
1035  if (kd)
1036  kd->repeattimes = tmp16;
1037 
1038  BadWords *bw = ci->Require<BadWords>("badwords");
1039  READ(read_uint16(&tmpu16, f));
1040  for (uint16_t j = 0; j < tmpu16; ++j)
1041  {
1042  uint16_t in_use;
1043  READ(read_uint16(&in_use, f));
1044  if (in_use)
1045  {
1046  READ(read_string(buffer, f));
1047  uint16_t type;
1048  READ(read_uint16(&type, f));
1049 
1050  BadWordType bwtype = BW_ANY;
1051  if (type == 1)
1052  bwtype = BW_SINGLE;
1053  else if (type == 2)
1054  bwtype = BW_START;
1055  else if (type == 3)
1056  bwtype = BW_END;
1057 
1058  if (bw)
1059  bw->AddBadWord(buffer, bwtype);
1060  }
1061  }
1062 
1063  if (forbid_chan)
1064  {
1065  if (!forbid)
1066  {
1067  delete ci;
1068  continue;
1069  }
1070 
1071  if (ci->name.find_first_of("?*") != Anope::string::npos)
1072  {
1073  delete ci;
1074  continue;
1075  }
1076 
1077  ForbidData *d = forbid->CreateForbid();
1078  d->mask = ci->name;
1079  d->creator = forbidby;
1080  d->reason = forbidreason;
1081  d->expires = 0;
1082  d->created = 0;
1083  d->type = FT_CHAN;
1084  delete ci;
1085  forbid->AddForbid(d);
1086  continue;
1087  }
1088 
1089  Log(LOG_DEBUG) << "Loaded channel " << ci->name;
1090  }
1091 
1092  close_db(f);
1093 }
1094 
1095 static void LoadOper()
1096 {
1097  dbFILE *f = open_db_read("OperServ", "oper.db", 13);
1098  if (f == NULL)
1099  return;
1100 
1101  XLineManager *akill, *sqline, *snline, *szline;
1102  akill = sqline = snline = szline = NULL;
1103 
1104  for (std::list<XLineManager *>::iterator it = XLineManager::XLineManagers.begin(), it_end = XLineManager::XLineManagers.end(); it != it_end; ++it)
1105  {
1106  XLineManager *xl = *it;
1107  if (xl->Type() == 'G')
1108  akill = xl;
1109  else if (xl->Type() == 'Q')
1110  sqline = xl;
1111  else if (xl->Type() == 'N')
1112  snline = xl;
1113  else if (xl->Type() == 'Z')
1114  szline = xl;
1115  }
1116 
1117  int32_t tmp32;
1118  READ(read_int32(&tmp32, f));
1119  READ(read_int32(&tmp32, f));
1120 
1121  int16_t capacity;
1122  read_int16(&capacity, f); // AKill count
1123  for (int16_t i = 0; i < capacity; ++i)
1124  {
1125  Anope::string user, host, by, reason;
1126  int32_t seton, expires;
1127 
1128  READ(read_string(user, f));
1129  READ(read_string(host, f));
1130  READ(read_string(by, f));
1131  READ(read_string(reason, f));
1132  READ(read_int32(&seton, f));
1133  READ(read_int32(&expires, f));
1134 
1135  if (!akill)
1136  continue;
1137 
1138  XLine *x = new XLine(user + "@" + host, by, expires, reason, XLineManager::GenerateUID());
1139  x->created = seton;
1140  akill->AddXLine(x);
1141  }
1142 
1143  read_int16(&capacity, f); // SNLines
1144  for (int16_t i = 0; i < capacity; ++i)
1145  {
1146  Anope::string mask, by, reason;
1147  int32_t seton, expires;
1148 
1149  READ(read_string(mask, f));
1150  READ(read_string(by, f));
1151  READ(read_string(reason, f));
1152  READ(read_int32(&seton, f));
1153  READ(read_int32(&expires, f));
1154 
1155  if (!snline)
1156  continue;
1157 
1158  XLine *x = new XLine(mask, by, expires, reason, XLineManager::GenerateUID());
1159  x->created = seton;
1160  snline->AddXLine(x);
1161  }
1162 
1163  read_int16(&capacity, f); // SQLines
1164  for (int16_t i = 0; i < capacity; ++i)
1165  {
1166  Anope::string mask, by, reason;
1167  int32_t seton, expires;
1168 
1169  READ(read_string(mask, f));
1170  READ(read_string(by, f));
1171  READ(read_string(reason, f));
1172  READ(read_int32(&seton, f));
1173  READ(read_int32(&expires, f));
1174 
1175  if (!sqline)
1176  continue;
1177 
1178  XLine *x = new XLine(mask, by, expires, reason, XLineManager::GenerateUID());
1179  x->created = seton;
1180  sqline->AddXLine(x);
1181  }
1182 
1183  read_int16(&capacity, f); // SZLines
1184  for (int16_t i = 0; i < capacity; ++i)
1185  {
1186  Anope::string mask, by, reason;
1187  int32_t seton, expires;
1188 
1189  READ(read_string(mask, f));
1190  READ(read_string(by, f));
1191  READ(read_string(reason, f));
1192  READ(read_int32(&seton, f));
1193  READ(read_int32(&expires, f));
1194 
1195  if (!szline)
1196  continue;
1197 
1198  XLine *x = new XLine(mask, by, expires, reason, XLineManager::GenerateUID());
1199  x->created = seton;
1200  szline->AddXLine(x);
1201  }
1202 
1203  close_db(f);
1204 }
1205 
1206 static void LoadExceptions()
1207 {
1208  if (!session_service)
1209  return;
1210 
1211  dbFILE *f = open_db_read("OperServ", "exception.db", 9);
1212  if (f == NULL)
1213  return;
1214 
1215  int16_t num;
1216  READ(read_int16(&num, f));
1217  for (int i = 0; i < num; ++i)
1218  {
1219  Anope::string mask, reason;
1220  int16_t limit;
1221  char who[32];
1222  int32_t time, expires;
1223 
1224  READ(read_string(mask, f));
1225  READ(read_int16(&limit, f));
1226  READ(read_buffer(who, f));
1227  READ(read_string(reason, f));
1228  READ(read_int32(&time, f));
1229  READ(read_int32(&expires, f));
1230 
1231  Exception *exception = session_service->CreateException();
1232  exception->mask = mask;
1233  exception->limit = limit;
1234  exception->who = who;
1235  exception->time = time;
1236  exception->expires = expires;
1237  exception->reason = reason;
1238  session_service->AddException(exception);
1239  }
1240 
1241  close_db(f);
1242 }
1243 
1244 static void LoadNews()
1245 {
1246  if (!news_service)
1247  return;
1248 
1249  dbFILE *f = open_db_read("OperServ", "news.db", 9);
1250 
1251  if (f == NULL)
1252  return;
1253 
1254  int16_t n;
1255  READ(read_int16(&n, f));
1256 
1257  for (int16_t i = 0; i < n; i++)
1258  {
1259  int16_t type;
1260  NewsItem *ni = news_service->CreateNewsItem();
1261 
1262  READ(read_int16(&type, f));
1263 
1264  switch (type)
1265  {
1266  case OLD_NEWS_LOGON:
1267  ni->type = NEWS_LOGON;
1268  break;
1269  case OLD_NEWS_OPER:
1270  ni->type = NEWS_OPER;
1271  break;
1272  case OLD_NEWS_RANDOM:
1273  ni->type = NEWS_RANDOM;
1274  break;
1275  }
1276 
1277  int32_t unused;
1278  READ(read_int32(&unused, f));
1279 
1280  READ(read_string(ni->text, f));
1281 
1282  char who[32];
1283  READ(read_buffer(who, f));
1284  ni->who = who;
1285 
1286  int32_t tmp;
1287  READ(read_int32(&tmp, f));
1288  ni->time = tmp;
1289 
1290  news_service->AddNewsItem(ni);
1291  }
1292 
1293  close_db(f);
1294 }
1295 
1296 class DBOld : public Module
1297 {
1300 
1301  public:
1302  DBOld(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR),
1303  mlock_on(this, "mlock_on"), mlock_off(this, "mlock_off"), mlock_limit(this, "mlock_limit"), mlock_key(this, "mlock_key")
1304  {
1305 
1306 
1307  hashm = Config->GetModule(this)->Get<const Anope::string>("hash");
1308 
1309  if (hashm != "md5" && hashm != "oldmd5" && hashm != "sha1" && hashm != "plain" && hashm != "sha256")
1310  throw ModuleException("Invalid hash method");
1311  }
1312 
1314  {
1315  LoadNicks();
1316  LoadVHosts();
1317  LoadBots();
1318  LoadChannels();
1319  LoadOper();
1320  LoadExceptions();
1321  LoadNews();
1322 
1323  return EVENT_STOP;
1324  }
1325 
1327  {
1328  for (registered_channel_map::iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
1329  {
1330  ChannelInfo *ci = it->second;
1331  uint32_t *limit = mlock_limit.Get(ci);
1332  Anope::string *key = mlock_key.Get(ci);
1333 
1334  uint32_t *u = mlock_on.Get(ci);
1335  if (u)
1336  {
1337  process_mlock(ci, *u, true, limit, key);
1338  mlock_on.Unset(ci);
1339  }
1340 
1341  u = mlock_off.Get(ci);
1342  if (u)
1343  {
1344  process_mlock(ci, *u, false, limit, key);
1345  mlock_off.Unset(ci);
1346  }
1347 
1348  mlock_limit.Unset(ci);
1349  mlock_key.Unset(ci);
1350 
1351  if (ci->c)
1352  ci->c->CheckModes();
1353  }
1354  }
1355 };
1356 
1358 
Definition: bots.h:24
PrimitiveExtensibleItem< Anope::string > mlock_key
Definition: db_old.cpp:1299
char c
Definition: db_old.cpp:98
#define OLD_NI_HIDE_QUIT
Definition: db_old.cpp:45
#define OLD_BS_DONTKICKVOICES
Definition: db_old.cpp:76
#define OLD_CI_SECUREOPS
Definition: db_old.cpp:57
#define OLD_BS_KICK_UNDERLINES
Definition: db_old.cpp:86
static NickAlias * Find(const Anope::string &nick)
Definition: nickalias.cpp:121
const char & Type()
Definition: xline.cpp:271
Definition: servers.h:42
#define OLD_NI_MEMO_SIGNON
Definition: db_old.cpp:40
#define OLD_BS_GREET
Definition: db_old.cpp:79
Anope::string message
Definition: cs_entrymsg.h:13
NewsType type
Definition: os_news.h:20
static int read_uint16(uint16_t *ret, dbFILE *f)
Definition: db_old.cpp:369
static int read_string(Anope::string &str, dbFILE *f)
Definition: db_old.cpp:383
#define OLD_BS_KICK_BOLDS
Definition: db_old.cpp:83
int read_int32(int32_t *ret, dbFILE *f)
Definition: db_old.cpp:419
static Anope::string GetLevelName(int level)
Definition: db_old.cpp:217
Definition: hashcomp.h:84
void clear()
Definition: anope.h:187
time_t time
Definition: os_session.h:19
Anope::string name
Definition: regchannel.h:63
#define OLD_BI_PRIVATE
Definition: db_old.cpp:34
#define OLD_NI_KILLPROTECT
Definition: db_old.cpp:36
time_t created
Definition: os_forbid.h:18
#define OLD_CI_PEACE
Definition: db_old.cpp:61
Anope::string text
Definition: memo.h:34
#define OLD_CI_TOPICLOCK
Definition: db_old.cpp:59
static void LoadBots()
Definition: db_old.cpp:702
Anope::string desc
Definition: regchannel.h:64
unsigned limit
Definition: os_session.h:16
#define OLD_CI_KEEPTOPIC
Definition: db_old.cpp:56
Anope::string nick
Definition: account.h:37
static void LoadNews()
Definition: db_old.cpp:1244
time_t expires
Definition: suspend.h:14
#define OLD_NI_KILL_IMMED
Definition: db_old.cpp:47
ForbidType type
Definition: os_forbid.h:20
Anope::string last_usermask
Definition: account.h:41
#define OLD_CI_SECUREFOUNDER
Definition: db_old.cpp:68
Anope::string reason
Definition: suspend.h:13
#define OLD_BS_KICK_BADWORDS
Definition: db_old.cpp:87
#define OLD_BS_DONTKICKOPS
Definition: db_old.cpp:75
#define OLD_CI_NO_EXPIRE
Definition: db_old.cpp:65
time_t last_topic_time
Definition: regchannel.h:71
Anope::string what
Definition: suspend.h:13
virtual EntryMsg * Create()=0
int mode
Definition: db_old.cpp:311
Anope::string sender
Definition: memo.h:33
T * Extend(const Anope::string &name, const T &what)
Definition: extensible.h:224
Anope::string who
Definition: os_news.h:22
static int read_int16(int16_t *ret, dbFILE *f)
Definition: db_old.cpp:355
Anope::string creator
Definition: access.h:93
#define OLD_NEWS_LOGON
Definition: db_old.cpp:92
string upper() const
Definition: anope.h:266
static void LoadChannels()
Definition: db_old.cpp:736
std::vector< Anope::string > access
Definition: account.h:121
#define OLD_NI_MSG
Definition: db_old.cpp:38
time_t created
Definition: access.h:95
void SetLevel(const Anope::string &priv, int16_t level)
Definition: regchannel.cpp:595
virtual bool SetMLock(ChannelMode *mode, bool status, const Anope::string &param="", Anope::string setter="", time_t created=Anope::CurTime)=0
Anope::string mask
Definition: os_forbid.h:15
size_type find_first_of(const string &_str, size_type pos=0) const
Definition: anope.h:202
void Unset(Extensible *obj) anope_override
Definition: extensible.h:95
#define OLD_NI_MEMO_RECEIVE
Definition: db_old.cpp:41
T * Require(const Anope::string &name)
Definition: extensible.h:244
static int read_uint32(uint32_t *ret, dbFILE *f)
Definition: db_old.cpp:403
Anope::string reason
Definition: os_forbid.h:17
static dbFILE * open_db_read(const char *service, const char *filename, int version)
Definition: db_old.cpp:316
CoreExport time_t CurTime
Definition: main.cpp:41
#define OLD_NI_AUTOOP
Definition: db_old.cpp:51
virtual void AccessUnserialize(const Anope::string &data)=0
PrimitiveExtensibleItem< uint32_t > mlock_on
Definition: db_old.cpp:1298
Anope::string pass
Definition: account.h:115
#define read_buffer(buf, f)
Definition: db_old.cpp:32
#define OLD_BS_KICK_CAPS
Definition: db_old.cpp:88
MemoInfo memos
Definition: account.h:122
Definition: cs_entrymsg.h:21
static void LoadExceptions()
Definition: db_old.cpp:1206
#define OLD_BS_KICK_REVERSES
Definition: db_old.cpp:85
int16_t bantype
Definition: regchannel.h:75
#define OLD_BS_KICK_FLOOD
Definition: db_old.cpp:89
static const char Base64[]
Definition: db_old.cpp:164
time_t time
Definition: os_news.h:23
#define OLD_BS_KICK_REPEAT
Definition: db_old.cpp:90
#define OLD_CI_SECURE
Definition: db_old.cpp:62
void SetSuccessor(NickCore *nc)
Definition: regchannel.cpp:369
size_type length() const
Definition: anope.h:131
void CheckModes()
Definition: channels.cpp:105
static void LoadVHosts()
Definition: db_old.cpp:670
DBOld(const Anope::string &modname, const Anope::string &creator)
Definition: db_old.cpp:1302
Definition: Config.cs:26
Channel * c
Definition: regchannel.h:79
void Shrink(const Anope::string &name)
Definition: extensible.h:253
time_t last_seen
Definition: access.h:94
static const size_type npos
Definition: anope.h:44
#define OLD_CI_SIGNKICK_LEVEL
Definition: db_old.cpp:70
FILE * fp
Definition: db_old.cpp:312
CoreExport Serialize::Checker< registered_channel_map > RegisteredChannelList
time_t time_registered
Definition: account.h:44
time_t last_used
Definition: regchannel.h:67
#define OLD_CI_RESTRICTED
Definition: db_old.cpp:60
time_t when
Definition: suspend.h:14
static struct mlock_info mlock_infos[]
static char * strscpy(char *d, const char *s, size_t len)
Definition: db_old.cpp:298
#define OLD_CI_PRIVATE
Definition: db_old.cpp:58
Definition: memo.h:19
#define OLD_NI_SUSPENDED
Definition: db_old.cpp:50
Anope::string display
Definition: account.h:113
time_t expires
Definition: os_session.h:20
void SetFounder(NickCore *nc)
Definition: regchannel.cpp:347
static ChannelMode * FindChannelModeByChar(char mode)
Definition: modes.cpp:524
#define OLD_BS_NOBOT
Definition: db_old.cpp:80
#define OLD_BS_FANTASY
Definition: db_old.cpp:77
Serialize::Reference< ChannelInfo > ci
Definition: access.h:92
virtual ChanAccess * Create()=0
#define OLD_NS_VERBOTEN
Definition: db_old.cpp:54
#define anope_override
Definition: services.h:56
bool empty() const
Definition: anope.h:126
Definition: cs_entrymsg.h:9
void AddAccess(ChanAccess *access)
Definition: regchannel.cpp:398
Anope::string last_topic_setter
Definition: regchannel.h:70
static void my_b64_encode(const Anope::string &src, Anope::string &target)
Definition: db_old.cpp:167
#define getc_db(f)
Definition: db_old.cpp:30
MemoInfo memos
Definition: regchannel.h:77
std::basic_string< char, ci_char_traits, std::allocator< char > > string
Definition: hashcomp.h:133
EventReturn
Definition: modules.h:129
#define MODULE_INIT(x)
Definition: modules.h:45
#define OLD_NI_SECURE
Definition: db_old.cpp:37
bool bolds
Definition: bs_kick.h:32
time_t created
Definition: bots.h:29
static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status, uint32_t *limit, Anope::string *key)
Definition: db_old.cpp:145
int16_t memomax
Definition: memo.h:42
Anope::string creator
Definition: os_forbid.h:16
#define OLD_NI_HIDE_STATUS
Definition: db_old.cpp:49
static std::list< XLineManager * > XLineManagers
Definition: xline.h:62
Anope::string stringify(const T &x)
Definition: anope.h:710
static ServiceReference< NewsService > news_service("NewsService","news")
Anope::string last_topic
Definition: regchannel.h:69
CoreExport Anope::string DataDir
Definition: init.cpp:33
#define OLD_CI_SUSPENDED
Definition: db_old.cpp:72
#define OLD_CI_MEMO_HARDMAX
Definition: db_old.cpp:66
bool oper_only
Definition: bots.h:41
Anope::string nick
Definition: users.h:62
PrimitiveExtensibleItem< uint32_t > mlock_off
Definition: db_old.cpp:1298
#define OLD_NEWS_OPER
Definition: db_old.cpp:93
Anope::string who
Definition: os_session.h:17
Serialize::Checker< std::vector< Memo * > > memos
Definition: memo.h:43
#define OLD_NEWS_RANDOM
Definition: db_old.cpp:94
#define OLD_NI_MEMO_MAIL
Definition: db_old.cpp:48
#define OLD_BS_KICK_COLORS
Definition: db_old.cpp:84
time_t last_seen
Definition: account.h:45
static Anope::string Hex(const char *data, size_t l)
Definition: db_old.cpp:203
#define READ(x)
Definition: db_old.cpp:21
#define OLD_NI_HIDE_MASK
Definition: db_old.cpp:44
#define OLD_CI_SIGNKICK
Definition: db_old.cpp:69
#define OLD_CI_VERBOTEN
Definition: db_old.cpp:63
uint32_t m
Definition: db_old.cpp:99
Definition: xline.h:18
Anope::string creator
Definition: cs_entrymsg.h:12
static void LoadNicks()
Definition: db_old.cpp:435
T * Get(const Extensible *obj) const
Definition: extensible.h:103
#define OLD_NS_NO_EXPIRE
Definition: db_old.cpp:53
static Anope::string hashm
Definition: db_old.cpp:123
#define OLD_NI_MEMO_HARDMAX
Definition: db_old.cpp:39
char filename[1024]
Definition: db_old.cpp:313
time_t expires
Definition: os_forbid.h:19
static const char Pad64
Definition: db_old.cpp:165
Anope::string last_realname
Definition: account.h:39
virtual BadWord * AddBadWord(const Anope::string &word, BadWordType type)=0
#define OLD_NI_PRIVATE
Definition: db_old.cpp:42
Definition: logger.h:53
void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created=Anope::CurTime)
Definition: nickalias.cpp:80
PrimitiveExtensibleItem< uint32_t > mlock_limit
Definition: db_old.cpp:1298
#define OLD_NI_KILL_QUICK
Definition: db_old.cpp:46
time_t time
Definition: memo.h:32
EventReturn OnLoadDatabase() anope_override
Definition: db_old.cpp:1313
Anope::string text
Definition: os_news.h:21
Anope::string mask
Definition: os_session.h:15
Anope::string last_quit
Definition: account.h:38
static void LoadOper()
Definition: db_old.cpp:1095
void SetMask(const Anope::string &mask, ChannelInfo *ci)
Definition: access.cpp:165
AutoKick * AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t=Anope::CurTime, time_t lu=0)
Definition: regchannel.cpp:519
Serialize::Reference< BotInfo > bi
Definition: regchannel.h:82
void AddXLine(XLine *x)
Definition: xline.cpp:286
Anope::string reason
Definition: os_session.h:18
static Anope::string GenerateUID()
Definition: xline.cpp:234
void close_db(dbFILE *f)
Definition: db_old.cpp:349
static NickCore * Find(const Anope::string &nick)
Definition: nickcore.cpp:258
#define OLD_CI_XOP
Definition: db_old.cpp:71
BadWordType
Definition: bs_badwords.h:16
Anope::string email
Definition: account.h:116
time_t created
Definition: xline.h:27
void OnUplinkSync(Server *s) anope_override
Definition: db_old.cpp:1326
Anope::string owner
Definition: memo.h:30
static BotInfo * Find(const Anope::string &nick, bool nick_only=false)
Definition: bots.cpp:249
Anope::string language
Definition: account.h:118
Anope::string chan
Definition: cs_entrymsg.h:11
time_t time_registered
Definition: regchannel.h:66
static ServiceReference< SessionService > session_service("SessionService","session")
#define OLD_NI_HIDE_EMAIL
Definition: db_old.cpp:43
Anope::string by
Definition: suspend.h:13
time_t when
Definition: cs_entrymsg.h:14