summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools/db-convert.c40
-rw-r--r--src/tools/db-convert.h15
2 files changed, 54 insertions, 1 deletions
diff --git a/src/tools/db-convert.c b/src/tools/db-convert.c
index 3c038fd87..9a7459eae 100644
--- a/src/tools/db-convert.c
+++ b/src/tools/db-convert.c
@@ -223,7 +223,7 @@ int main(int argc, char *argv[])
b64_encode(nc->pass, hashm == "plain" ? strlen(nc->pass) : 32, (char *)cpass, 5000);
fs << "NC " << nc->display << " " << hashm << ":" << cpass << " " << nc->email;
- fs << " " << GetLanguageID(nc->language) << nc->memos.memomax << " " << nc->channelcount << std::endl;
+ fs << " " << GetLanguageID(nc->language) << " " << nc->memos.memomax << " " << nc->channelcount << std::endl;
std::cout << "Wrote account for " << nc->display << " passlen " << strlen(cpass) << std::endl;
if (nc->greet)
@@ -692,6 +692,44 @@ int main(int argc, char *argv[])
READ(read_int16(&tmp16, f));
bi->chancount = tmp16;
insert_bot(bi);
+
+ /* fix for the 1.9.0 broken bot.db */
+ if ((stricmp(bi->nick, "ChanServ")==0) && !(bi->flags & BI_CHANSERV))
+ {
+ bi->flags = 0;
+ bi->flags |= BI_CHANSERV;
+ }
+ if ((stricmp(bi->nick, "BotServ")==0) && !(bi->flags & BI_BOTSERV))
+ {
+ bi->flags = 0;
+ bi->flags |= BI_BOTSERV | BI_PRIVATE;
+ }
+ if ((stricmp(bi->nick, "HostServ")==0) && !(bi->flags & BI_HOSTSERV))
+ {
+ bi->flags = 0;
+ bi->flags |= BI_HOSTSERV | BI_PRIVATE;
+ }
+ if ((stricmp(bi->nick, "OperServ")==0) && !(bi->flags & BI_OPERSERV))
+ {
+ bi->flags = 0;
+ bi->flags |= BI_OPERSERV | BI_PRIVATE;
+ }
+ if ((stricmp(bi->nick, "MemoServ")==0) && !(bi->flags & BI_MEMOSERV))
+ {
+ bi->flags = 0;
+ bi->flags |= BI_MEMOSERV | BI_PRIVATE;
+ }
+ if ((stricmp(bi->nick, "NickServ")==0) && !(bi->flags & BI_NICKSERV))
+ {
+ bi->flags = 0;
+ bi->flags |= BI_NICKSERV | BI_PRIVATE;
+ }
+ if ((stricmp(bi->nick, "Global")==0) && !(bi->flags & BI_GLOBAL))
+ {
+ bi->flags = 0;
+ bi->flags |= BI_GLOBAL | BI_PRIVATE;
+ }
+ /* end of 1.9.0 broken database fix */
}
}
diff --git a/src/tools/db-convert.h b/src/tools/db-convert.h
index f1bd68d44..edc0441e2 100644
--- a/src/tools/db-convert.h
+++ b/src/tools/db-convert.h
@@ -1163,4 +1163,19 @@ static long base64_to_int(char *b64)
return v;
}
+int stricmp(const char *s1, const char *s2)
+{
+ register int c;
+
+ while ((c = tolower(*s1)) == tolower(*s2)) {
+ if (c == 0)
+ return 0;
+ s1++;
+ s2++;
+ }
+ if (c < tolower(*s2))
+ return -1;
+ return 1;
+}
+