diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-02 08:20:59 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-02 08:20:59 +0000 |
| commit | a819cb0cc0f54a042a088dfba9c1f6b817928641 (patch) | |
| tree | 7931a9d81367c184ca2550a1819ef685e3e0c927 /src/tools/db-convert.c | |
| parent | 3617d7978899f830d952d9bac70ed14bb0cc0fd6 (diff) | |
Rewrote the vhost code, and moved it to be part of nickalias instead of in its own list. This also fixes being able to steal other users vhosts with /hs on
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2724 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/tools/db-convert.c')
| -rw-r--r-- | src/tools/db-convert.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/src/tools/db-convert.c b/src/tools/db-convert.c index fbef58eed..c70f41ecd 100644 --- a/src/tools/db-convert.c +++ b/src/tools/db-convert.c @@ -324,6 +324,28 @@ int main(int argc, char *argv[]) } } + head = NULL; + if ((f = open_db_read("HostServ", "hosts.db", 3))) + { + int c; + HostCore *hc; + + while ((c = getc_db(f)) == 1) + { + hc = (HostCore *)calloc(1, sizeof(HostCore)); + READ(read_string(&hc->nick, f)); + READ(read_string(&hc->vIdent, f)); + READ(read_string(&hc->vHost, f)); + READ(read_string(&hc->creator, f)); + READ(read_int32(&hc->time, f)); + + hc->next = head; + head = hc; + } + + close_db(f); + } + /* Nick cores */ for (i = 0; i < 1024; i++) { @@ -432,6 +454,12 @@ int main(int argc, char *argv[]) << ((na->status & NS_FORBIDDEN) ? " FORBIDDEN" : "") << ((na->status & NS_NO_EXPIRE) ? " NOEXPIRE" : "") << std::endl; } + + HostCore *hc = findHostCore(na->nick); + if (hc) + { + fs << "MD VHOST " << hc->creator << " " << hc->time << " " << hc->vHost << " :" << hc->vIdent << std::endl; + } } } } @@ -891,33 +919,6 @@ int main(int argc, char *argv[]) } /* for (chanlists[i]) */ } /* for (i) */ - /* Section IV: Hosts */ - /* IVa: First database */ - if ((f = open_db_read("HostServ", "hosts.db", 3))) { - int c; - int32 time; - char *nick, *vIdent, *vHost, *creator; - - std::cout << "Converting hosts..." << std::endl; - - while ((c = getc_db(f)) == 1) { - READ(read_string(&nick, f)); - READ(read_string(&vIdent, f)); - READ(read_string(&vHost, f)); - READ(read_string(&creator, f)); - READ(read_int32(&time, f)); - if (vIdent) - std::cout << "Writing vHost for " << nick << " (" << vIdent << "@" << vHost << ")" << std::endl; - else - std::cout << "Writing vHost for " << nick << " (" << vHost << ")" << std::endl; - // because vIdent can sometimes be empty, we put it at the end of the list - fs << "HI " << nick << " " << creator << " " << time << " " << vHost << " :" - << (vIdent ? vIdent : "") << std::endl; - free(nick); if (vIdent) free(vIdent); free(vHost); free(creator); - } - close_db(f); - } // host database - /*********************************/ /* OPERSERV Section */ /*********************************/ |
