From 8dad78c3139adad40d7f5f1bfa3d78014ebd4511 Mon Sep 17 00:00:00 2001 From: Emil Date: Fri, 4 Aug 2023 02:19:55 -0600 Subject: [PATCH] merging --- bootstrap/bootstrap.sh | 2 -- docs/rizon_cred.txt | 4 ---- docs/rizon_default.cfg | 8 ++++++++ include/api.h | 2 ++ include/parse.h | 1 + src/api.c | 3 ++- src/main.c | 10 ++++++---- 7 files changed, 19 insertions(+), 11 deletions(-) delete mode 100644 docs/rizon_cred.txt create mode 100644 docs/rizon_default.cfg diff --git a/bootstrap/bootstrap.sh b/bootstrap/bootstrap.sh index 5c2cb54..9c0f5c2 100644 --- a/bootstrap/bootstrap.sh +++ b/bootstrap/bootstrap.sh @@ -1,4 +1,2 @@ #!/bin/sh -# Tested to work 100% of the time when that file doesn't exist -# probably sqlite3 probotic_data.sqlite -init init.sql -line '.quit' diff --git a/docs/rizon_cred.txt b/docs/rizon_cred.txt deleted file mode 100644 index 2b10da4..0000000 --- a/docs/rizon_cred.txt +++ /dev/null @@ -1,4 +0,0 @@ -server=irc.rizon.net -username=probotic -port=6667 -channel=#stop_shitting_up_chad diff --git a/docs/rizon_default.cfg b/docs/rizon_default.cfg new file mode 100644 index 0000000..1793dcd --- /dev/null +++ b/docs/rizon_default.cfg @@ -0,0 +1,8 @@ +server=irc.rizon.net +username=probotic +port=6667 +admins=anon8697 emilemilemil fa11_1eaf + +; provide channel yourself +; lines without an equal sign are dropped +; prefix comments with a semicolon for future compat diff --git a/include/api.h b/include/api.h index 5a28ff4..de83b98 100644 --- a/include/api.h +++ b/include/api.h @@ -6,5 +6,7 @@ DECL void rope(void); DECL char * remind(char * who); DECL char * raw(char const * const sql); +extern char const * db; + #define API_H_ #endif diff --git a/include/parse.h b/include/parse.h index ae57860..26efe7a 100644 --- a/include/parse.h +++ b/include/parse.h @@ -6,6 +6,7 @@ typedef struct char * password; char * channel; char * server; + char * admin; int port; } creds_t; diff --git a/src/api.c b/src/api.c index 6979a0b..9263d3b 100644 --- a/src/api.c +++ b/src/api.c @@ -21,7 +21,8 @@ } \ } while (0) -static char const * db = DBFILE; +char const * db = DBFILE; + static sqlite3 * connection = NULL; DECL int diff --git a/src/main.c b/src/main.c index d852128..4d98d6f 100644 --- a/src/main.c +++ b/src/main.c @@ -81,15 +81,17 @@ main (int argc, if (strcmp(arg, "db") == 0) { db = argv[1]; } else if (strcmp(arg, "server") == 0) - { FREE(creds.server); creds.server = argv[1]; } + { FREE(creds.server); creds.server = strdup(argv[1]); } else if (strcmp(arg, "port") == 0) { creds.port = atoi(argv[1]); } else if (strcmp(arg, "channel") == 0) - { FREE(creds.channel);creds.channel = argv[1]; } + { FREE(creds.channel); creds.channel = strdup(argv[1]); } else if (strcmp(arg, "username") == 0) - { FREE(creds.username); creds.username = argv[1]; } + { FREE(creds.username); creds.username = strdup(argv[1]); } else if (strcmp(arg, "password") == 0) - { FREE(creds.password); creds.password = argv[1]; } + { FREE(creds.password); creds.password = strdup(argv[1]); } + else if (strcmp(arg, "admin") == 0) + { FREE(creds.admin); creds.admin = strdup(argv[1]); } else if (strcmp(arg, "auth") == 0) { authfile = argv[1];