diff --git a/src/tools/db-convert.c b/src/tools/db-convert.c index c910c35db..84298c9d2 100644 --- a/src/tools/db-convert.c +++ b/src/tools/db-convert.c @@ -16,6 +16,87 @@ #include "db-convert.h" +static std::string GetLevelName(int level) +{ + switch (level) + { + case 0: + return "INVITE"; + case 1: + return "AKICK"; + case 2: + return "SET"; + case 3: + return "UNBAN"; + case 4: + return "AUTOOP"; + case 5: + return "AUTODEOP"; + case 6: + return "AUTOVOICE"; + case 7: + return "OPDEOP"; + case 8: + return "ACCESS_LIST"; + case 9: + return "CLEAR"; + case 10: + return "NOJOIN"; + case 11: + return "ACCESS_CHANGE"; + case 12: + return "MEMO"; + case 13: + return "ASSIGN"; + case 14: + return "BADWORDS"; + case 15: + return "NOKICK"; + case 16: + return "FANTASIA"; + case 17: + return "SAY"; + case 18: + return "GREET"; + case 19: + return "VOICEME"; + case 20: + return "VOICE"; + case 21: + return "GETKEY"; + case 22: + return "AUTOHALFOP"; + case 23: + return "AUTOPROTECT"; + case 24: + return "OPDEOPME"; + case 25: + return "HALFOPME"; + case 26: + return "HALFOP"; + case 27: + return "PROTECTME"; + case 28: + return "PROTECT"; + case 29: + return "KICKME"; + case 30: + return "KICK"; + case 31: + return "SIGNKICK"; + case 32: + return "BANME"; + case 33: + return "BAN"; + case 34: + return "TOPIC"; + case 35: + return "INFO"; + default: + return "INVALID"; + } +} + void process_mlock_modes(std::ofstream &fs, size_t m, const std::string &ircd) { /* this is the same in all protocol modules */ @@ -296,19 +377,19 @@ int main(int argc, char *argv[]) std::cout << "Wrote account for " << nc->display << " passlen " << strlen(cpass) << std::endl; if (nc->greet) - fs << "MD NC greet :" << nc->greet << std::endl; + fs << "MD GREET :" << nc->greet << std::endl; if (nc->icq) - fs << "MD NC icq :" << nc->icq << std::endl; + fs << "MD ICQ :" << nc->icq << std::endl; if (nc->url) - fs << "MD NC url :" << nc->url << std::endl; + fs << "MD URL :" << nc->url << std::endl; if (nc->accesscount) { for (j = 0, access = nc->access; j < nc->accesscount; j++, access++) - fs << "MD NC access " << *access << std::endl; + fs << "MD ACCESS " << *access << std::endl; } - fs << "MD NC flags " + fs << "MD FLAGS " << ((nc->flags & NI_KILLPROTECT ) ? "KILLPROTECT " : "") << ((nc->flags & NI_SECURE ) ? "SECURE " : "") << ((nc->flags & NI_MSG ) ? "MSG " : "") @@ -331,7 +412,7 @@ int main(int argc, char *argv[]) { memos = nc->memos.memos; for (j = 0; j < nc->memos.memocount; j++, memos++) - fs << "ME " << memos->number << " " << memos->flags << " " << memos->time << " " << memos->sender << " :" << memos->text << std::endl; + fs << "MD MI " << memos->number << " " << memos->flags << " " << memos->time << " " << memos->sender << " :" << memos->text << std::endl; } /* we could do this in a seperate loop, I'm doing it here for tidiness. */ @@ -352,14 +433,14 @@ int main(int argc, char *argv[]) fs << "NA " << na->nc->display << " " << na->nick << " " << na->time_registered << " " << na->last_seen << std::endl; if (nc->last_usermask) - fs << "MD NA last_usermask :" << nc->last_usermask << std::endl; + fs << "MD LAST_USERMASK " << nc->last_usermask << std::endl; if (nc->last_realname) - fs << "MD NA last_realname :" << nc->last_realname << std::endl; + fs << "MD LAST_REALNAME :" << nc->last_realname << std::endl; if (nc->last_quit) - fs << "MD NA last_quit :" << nc->last_quit << std::endl; + fs << "MD LAST_QUIT :" << nc->last_quit << std::endl; if ((na->status & NS_FORBIDDEN) || (na->status & NS_NO_EXPIRE)) { - fs << "MD NA flags " + fs << "MD FLAGS " << ((na->status & NS_FORBIDDEN) ? "FORBIDDEN " : "") << ((na->status & NS_NO_EXPIRE) ? "NOEXPIRE" : "") << std::endl; } @@ -605,16 +686,16 @@ int main(int argc, char *argv[]) fs << "CH " << ci->name << " " << ci->time_registered << " " << ci->last_used; fs << " " << ci->bantype << " " << ci->memos.memomax << std::endl; if (ci->founder) - fs << "MD CH founder " << ci->founder << std::endl; + fs << "MD FOUNDER " << ci->founder << std::endl; if (ci->successor) - fs << "MD CH successor " << ci->successor << std::endl; - fs << "MD CH lvl"; + fs << "MD SUCCESSOR " << ci->successor << std::endl; + fs << "MD LEVELS"; for (j = 0; j < 36; j++) { - fs << " " <levels[j]; + fs << " " << GetLevelName(j) << " " << ci->levels[j]; } fs << std::endl; - fs << "MD CH flags " + fs << "MD FLAGS " << ((ci->flags & CI_KEEPTOPIC ) ? "KEEPTOPIC " : "") << ((ci->flags & CI_SECUREOPS ) ? "SECUREOPS " : "") << ((ci->flags & CI_PRIVATE ) ? "PRIVATE " : "") @@ -632,27 +713,27 @@ int main(int argc, char *argv[]) << ((ci->flags & CI_XOP ) ? "XOP " : "") << ((ci->flags & CI_SUSPENDED ) ? "SUSPENDED" : "") << std::endl; if (ci->desc) - fs << "MD CH desc :" << ci->desc << std::endl; + fs << "MD DESC :" << ci->desc << std::endl; if (ci->url) - fs << "MD CH url :" << ci->url << std::endl; + fs << "MD URL :" << ci->url << std::endl; if (ci->email) - fs << "MD CH email :" << ci->email << std::endl; + fs << "MD EMAIL :" << ci->email << std::endl; if (ci->last_topic) // MD CH topic