From 32d1c706223171ad1b7d6eb939ec804658d2d01a Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Tue, 16 Oct 2018 15:21:42 +0000 Subject: [PATCH] Mostly trivial whitespace cleanups. Clang-format and removing whitespace at the ends of lines. Signed-off-by: Dan Cross --- src/bluewave.c | 62 ++++++++++++++-------------- src/files.c | 22 +++++----- src/lua_glue.c | 14 +++---- src/mail_menu.c | 74 ++++++++++++++++----------------- src/main_menu.c | 2 +- src/menus.c | 105 ++++++++++++++++++++++++----------------------- src/users.c | 106 ++++++++++++++++++++++++------------------------ src/www_files.c | 2 +- 8 files changed, 193 insertions(+), 194 deletions(-) diff --git a/src/bluewave.c b/src/bluewave.c index f791e2f..a81f500 100644 --- a/src/bluewave.c +++ b/src/bluewave.c @@ -646,15 +646,15 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char if (mc->nettype == NETWORK_FIDO) { if (mc->fidoaddr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - mc->fidoaddr->zone, - mc->fidoaddr->net, - mc->fidoaddr->node, - mc->fidoaddr->point); + mc->fidoaddr->zone, + mc->fidoaddr->net, + mc->fidoaddr->node, + mc->fidoaddr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", - mc->fidoaddr->zone, - mc->fidoaddr->net, - mc->fidoaddr->node); + mc->fidoaddr->zone, + mc->fidoaddr->net, + mc->fidoaddr->node); } jsf.LoID = JAMSFLD_OADDRESS; jsf.HiID = 0; @@ -663,11 +663,11 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char JAM_PutSubfield(jsp, &jsf); snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx", - mc->fidoaddr->zone, - mc->fidoaddr->net, - mc->fidoaddr->node, - mc->fidoaddr->point, - generate_msgid()); + mc->fidoaddr->zone, + mc->fidoaddr->net, + mc->fidoaddr->node, + mc->fidoaddr->point, + generate_msgid()); jsf.LoID = JAMSFLD_MSGID; jsf.HiID = 0; @@ -705,15 +705,15 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char if (mc->fidoaddr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - mc->fidoaddr->zone, - mc->fidoaddr->net, - mc->fidoaddr->node, - mc->fidoaddr->point); + mc->fidoaddr->zone, + mc->fidoaddr->net, + mc->fidoaddr->node, + mc->fidoaddr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", - mc->fidoaddr->zone, - mc->fidoaddr->net, - mc->fidoaddr->node); + mc->fidoaddr->zone, + mc->fidoaddr->net, + mc->fidoaddr->node); } jsf.LoID = JAMSFLD_OADDRESS; jsf.HiID = 0; @@ -724,15 +724,15 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char if (destaddr != NULL) { if (destaddr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - destaddr->zone, - destaddr->net, - destaddr->node, - destaddr->point); + destaddr->zone, + destaddr->net, + destaddr->node, + destaddr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", - destaddr->zone, - destaddr->net, - destaddr->node); + destaddr->zone, + destaddr->net, + destaddr->node); } jsf.LoID = JAMSFLD_DADDRESS; jsf.HiID = 0; @@ -742,11 +742,11 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char } snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx", - mc->fidoaddr->zone, - mc->fidoaddr->net, - mc->fidoaddr->node, - mc->fidoaddr->point, - generate_msgid()); + mc->fidoaddr->zone, + mc->fidoaddr->net, + mc->fidoaddr->node, + mc->fidoaddr->point, + generate_msgid()); jsf.LoID = JAMSFLD_MSGID; jsf.HiID = 0; diff --git a/src/files.c b/src/files.c index 6c5e6a5..2ae941c 100644 --- a/src/files.c +++ b/src/files.c @@ -72,15 +72,15 @@ static struct file_sub *user_sub(struct user_record *user) { } static void open_sub_db_or_die(sqlite3 **db, char *sub) { - char buffer[PATH_MAX]; - snprintf(buffer, PATH_MAX, "%s/%s.sq3", conf.bbs_path, sub); - if (sqlite3_open(buffer, db) != SQLITE_OK) { - dolog("Cannot open database: %s", sqlite3_errmsg(*db)); - sqlite3_close(*db); - exit(1); - } - assert(db != NULL); - sqlite3_busy_timeout(*db, 5000); + char buffer[PATH_MAX]; + snprintf(buffer, PATH_MAX, "%s/%s.sq3", conf.bbs_path, sub); + if (sqlite3_open(buffer, db) != SQLITE_OK) { + dolog("Cannot open database: %s", sqlite3_errmsg(*db)); + sqlite3_close(*db); + exit(1); + } + assert(db != NULL); + sqlite3_busy_timeout(*db, 5000); } struct tagged_file **tagged_files; @@ -368,7 +368,7 @@ char *get_file_id_diz(char *filename) { } snprintf(buffer, sizeof buffer, "%s/node%d/temp", conf.bbs_path, mynode); - if (access(buffer, F_OK|W_OK) == 0) { + if (access(buffer, F_OK | W_OK) == 0) { if (recursive_delete(buffer) != 0) { return NULL; } @@ -677,7 +677,7 @@ int do_upload(struct user_record *user, char *final_path) { if (defproto->upload_prompt) { snprintf(upload_command, 1024, "%s%s", upload_path, buffer3); - if (access(upload_command, W_OK|X_OK) != 0) { + if (access(upload_command, W_OK | X_OK) != 0) { recursive_delete(upload_path); return 0; } diff --git a/src/lua_glue.c b/src/lua_glue.c index 2edd78a..9231682 100644 --- a/src/lua_glue.c +++ b/src/lua_glue.c @@ -469,13 +469,13 @@ int l_postMessage(lua_State *L) { if (mc->fidoaddr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - mc->fidoaddr->zone, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", - mc->fidoaddr->zone, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); } @@ -486,7 +486,7 @@ int l_postMessage(lua_State *L) { JAM_PutSubfield(jsp, &jsf); snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx", - mc->fidoaddr->zone, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point, @@ -528,12 +528,12 @@ int l_postMessage(lua_State *L) { if (mc->nettype == NETWORK_FIDO) { if (mc->fidoaddr->point == 0) { snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); } else { snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d.%d)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); } } else { snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r", diff --git a/src/mail_menu.c b/src/mail_menu.c index 0c8d95d..b114759 100644 --- a/src/mail_menu.c +++ b/src/mail_menu.c @@ -457,21 +457,21 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot if (mc->nettype == NETWORK_FIDO && !email) { if (mc->fidoaddr->point == 0) { snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); } else { snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d.%d)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); } } else if (mc->nettype == NETWORK_MAGI && !email) { snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (@%d)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - mc->maginode); + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + mc->maginode); } else if (mc->nettype == NETWORK_QWK && !email) { snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%s)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - conf.bwave_name); + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + conf.bwave_name); } else { snprintf(buffer, sizeof buffer, "\r"); } @@ -593,25 +593,25 @@ char *editor(struct user_record *user, char *quote, int quotelen, char *from, in if (mc->nettype == NETWORK_FIDO && !email) { if (mc->fidoaddr->point == 0) { snprintf(buffer, sizeof buffer, - "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); + "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d)\r", + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); } else { snprintf(buffer, sizeof buffer, - "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d.%d)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); + "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%d:%d/%d.%d)\r", + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); } } else if (mc->nettype == NETWORK_MAGI && !email) { snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (@%d)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - mc->maginode); + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + mc->maginode); } else if (mc->nettype == NETWORK_QWK && !email) { snprintf(buffer, sizeof buffer, - "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%s)\r", - VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, - conf.bwave_name); + "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%s)\r", + VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, + conf.bwave_name); } else { strlcpy(buffer, "\r", sizeof buffer); } @@ -1457,7 +1457,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno buffer[strlen(buffer) - 1] = '\0'; s_printf(get_string(109), buffer, mailno + 1, msghs->msg_count); s_printf(get_string(110), (msghs->msgs[mailno]->msg_h->Attribute & JAM_MSG_SENT ? "SENT" : ""), - (msgbase_is_flagged(user, user->cur_mail_conf, user->cur_mail_area, msghs->msgs[mailno]->msg_h->MsgNum) ? "FLAGGED" : "")); + (msgbase_is_flagged(user, user->cur_mail_conf, user->cur_mail_area, msghs->msgs[mailno]->msg_h->MsgNum) ? "FLAGGED" : "")); s_printf(get_string(111)); body = (char *)malloz(msghs->msgs[mailno]->msg_h->TxtLen); @@ -1658,11 +1658,11 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno if (mc->nettype == NETWORK_FIDO) { if (mc->fidoaddr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, - mc->fidoaddr->point); + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, + mc->fidoaddr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); } jsf.LoID = JAMSFLD_OADDRESS; jsf.HiID = 0; @@ -1671,7 +1671,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno JAM_PutSubfield(jsp, &jsf); snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx", - mc->fidoaddr->zone, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point, @@ -1732,7 +1732,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno if (mc->nettype == NETWORK_FIDO) { if (mc->fidoaddr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", @@ -1748,11 +1748,11 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno if (from_addr != NULL) { if (from_addr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - from_addr->zone, from_addr->net, from_addr->node, + from_addr->zone, from_addr->net, from_addr->node, from_addr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", - from_addr->zone, from_addr->net, from_addr->node); + from_addr->zone, from_addr->net, from_addr->node); } jsf.LoID = JAMSFLD_DADDRESS; jsf.HiID = 0; @@ -1763,8 +1763,8 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno } snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx", - mc->fidoaddr->zone, - mc->fidoaddr->net, + mc->fidoaddr->zone, + mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point, generate_msgid()); @@ -2123,11 +2123,11 @@ void post_message(struct user_record *user) { if (mc->nettype == NETWORK_FIDO) { if (mc->fidoaddr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); } jsf.LoID = JAMSFLD_OADDRESS; jsf.HiID = 0; @@ -2136,7 +2136,7 @@ void post_message(struct user_record *user) { JAM_PutSubfield(jsp, &jsf); snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx", - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point, generate_msgid()); jsf.LoID = JAMSFLD_MSGID; @@ -2176,11 +2176,11 @@ void post_message(struct user_record *user) { if (mc->nettype == NETWORK_FIDO) { if (mc->fidoaddr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", - mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node); } jsf.LoID = JAMSFLD_OADDRESS; jsf.HiID = 0; @@ -2191,11 +2191,11 @@ void post_message(struct user_record *user) { if (from_addr != NULL) { if (from_addr->point) { snprintf(buffer, sizeof buffer, "%d:%d/%d.%d", - from_addr->zone, from_addr->net, from_addr->node, + from_addr->zone, from_addr->net, from_addr->node, from_addr->point); } else { snprintf(buffer, sizeof buffer, "%d:%d/%d", - from_addr->zone, from_addr->net, from_addr->node); + from_addr->zone, from_addr->net, from_addr->node); } jsf.LoID = JAMSFLD_DADDRESS; jsf.HiID = 0; @@ -2207,7 +2207,7 @@ void post_message(struct user_record *user) { } snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx", - mc->fidoaddr->zone, + mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point, diff --git a/src/main_menu.c b/src/main_menu.c index cfcaa09..575e776 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -108,7 +108,7 @@ void display_textfiles() { s_printf(get_string(144)); for (size_t i = start; i < start + 22 && i < ptr_vector_len(&conf.text_files); i++) { struct text_file *file = ptr_vector_get(&conf.text_files, i); - s_printf(get_string(i == selected ? 249 : 250), i - start + 2, i, file->name); + s_printf(get_string(i == selected ? 249 : 250), i - start + 2, i, file->name); } s_printf("\e[%d;5H", selected - start + 2); redraw = 0; diff --git a/src/menus.c b/src/menus.c index 98dd79a..8238f41 100644 --- a/src/menus.c +++ b/src/menus.c @@ -83,60 +83,59 @@ struct key_value_map { }; static const struct key_value_map commands[] = { - { "SUBMENU", MENU_SUBMENU }, - { "LOGOFF", MENU_LOGOFF }, - { "PREVMENU", MENU_PREVMENU }, - { "AUTOMESSAGE", MENU_AUTOMESSAGE }, - { "TEXTFILES", MENU_TEXTFILES }, - { "CHATSYSTEM", MENU_CHATSYSTEM }, - { "BBSLIST", MENU_BBSLIST }, - { "LISTUSERS", MENU_LISTUSERS }, - { "BULLETINS", MENU_BULLETINS }, - { "LAST10CALLERS", MENU_LAST10 }, - { "SETTINGS", MENU_SETTINGS }, - { "RUNDOOR", MENU_DOOR }, - { "MAILSCAN", MENU_MAILSCAN }, - { "READMAIL", MENU_READMAIL }, - { "POSTMESSAGE", MENU_POSTMESSAGE }, - { "CHOOSEMAILCONF", MENU_CHOOSEMAILCONF }, - { "CHOOSEMAILAREA", MENU_CHOOSEMAILAREA }, - { "SENDEMAIL", MENU_SENDEMAIL }, - { "LISTEMAIL", MENU_LISTEMAIL }, - { "NEXTMAILCONF", MENU_NEXTMAILCONF }, - { "PREVMAILCONF", MENU_PREVMAILCONF }, - { "NEXTMAILAREA", MENU_NEXTMAILAREA }, - { "PREVMAILAREA", MENU_PREVMAILAREA }, - { "BLUEWAVEDOWNLOAD", MENU_BLUEWAVEDOWN }, - { "BLUEWAVEUPLOAD", MENU_BLUEWAVEUP }, - { "CHOOSEFILEDIR", MENU_CHOOSEFILEDIR }, - { "CHOOSEFILESUB", MENU_CHOOSEFILESUB }, - { "LISTFILES", MENU_LISTFILES }, - { "UPLOAD", MENU_UPLOAD }, - { "DOWNLOAD", MENU_DOWNLOAD }, - { "CLEARTAGGED", MENU_CLEARTAGGEDFILES }, - { "NEXTFILEDIR", MENU_NEXTFILEDIR }, - { "PREVFILEDIR", MENU_PREVFILEDIR }, - { "NEXTFILESUB", MENU_NEXTFILESUB }, - { "PREVFILESUB", MENU_PREVFILESUB }, - { "LISTMESSAGES", MENU_LISTMESSAGES }, - { "DOSCRIPT", MENU_DOSCRIPT }, - { "SENDNODEMSG", MENU_SENDNODEMSG }, - { "SUBUNSUBCONF", MENU_SUBUNSUBCONF }, - { "RESETMSGPTRS", MENU_RESETPOINTERS }, - { "RESETALLMSGPTRS", MENU_RESETALLPOINTERS }, - { "FILESCAN", MENU_FILESCAN }, - { "FULLMAILSCAN", MENU_FULLMAILSCAN }, - { "FILESEARCH", MENU_FILESEARCH }, - { "DISPLAYTXTFILE", MENU_DISPTXTFILE }, - { "DISPLAYTXTPAUSE", MENU_DISPTXTFILEPAUSE }, - { "GENWWWURLS", MENU_GENWWWURLS }, - { "NLBROWSER", MENU_NLBROWSER }, - { "SENDFEEDBACK", MENU_SENDFEEDBACK }, - { "BLOGDISPLAY", MENU_BLOGDISPLAY }, - { "BLOGWRITE", MENU_BLOGWRITE } -}; + {"SUBMENU", MENU_SUBMENU}, + {"LOGOFF", MENU_LOGOFF}, + {"PREVMENU", MENU_PREVMENU}, + {"AUTOMESSAGE", MENU_AUTOMESSAGE}, + {"TEXTFILES", MENU_TEXTFILES}, + {"CHATSYSTEM", MENU_CHATSYSTEM}, + {"BBSLIST", MENU_BBSLIST}, + {"LISTUSERS", MENU_LISTUSERS}, + {"BULLETINS", MENU_BULLETINS}, + {"LAST10CALLERS", MENU_LAST10}, + {"SETTINGS", MENU_SETTINGS}, + {"RUNDOOR", MENU_DOOR}, + {"MAILSCAN", MENU_MAILSCAN}, + {"READMAIL", MENU_READMAIL}, + {"POSTMESSAGE", MENU_POSTMESSAGE}, + {"CHOOSEMAILCONF", MENU_CHOOSEMAILCONF}, + {"CHOOSEMAILAREA", MENU_CHOOSEMAILAREA}, + {"SENDEMAIL", MENU_SENDEMAIL}, + {"LISTEMAIL", MENU_LISTEMAIL}, + {"NEXTMAILCONF", MENU_NEXTMAILCONF}, + {"PREVMAILCONF", MENU_PREVMAILCONF}, + {"NEXTMAILAREA", MENU_NEXTMAILAREA}, + {"PREVMAILAREA", MENU_PREVMAILAREA}, + {"BLUEWAVEDOWNLOAD", MENU_BLUEWAVEDOWN}, + {"BLUEWAVEUPLOAD", MENU_BLUEWAVEUP}, + {"CHOOSEFILEDIR", MENU_CHOOSEFILEDIR}, + {"CHOOSEFILESUB", MENU_CHOOSEFILESUB}, + {"LISTFILES", MENU_LISTFILES}, + {"UPLOAD", MENU_UPLOAD}, + {"DOWNLOAD", MENU_DOWNLOAD}, + {"CLEARTAGGED", MENU_CLEARTAGGEDFILES}, + {"NEXTFILEDIR", MENU_NEXTFILEDIR}, + {"PREVFILEDIR", MENU_PREVFILEDIR}, + {"NEXTFILESUB", MENU_NEXTFILESUB}, + {"PREVFILESUB", MENU_PREVFILESUB}, + {"LISTMESSAGES", MENU_LISTMESSAGES}, + {"DOSCRIPT", MENU_DOSCRIPT}, + {"SENDNODEMSG", MENU_SENDNODEMSG}, + {"SUBUNSUBCONF", MENU_SUBUNSUBCONF}, + {"RESETMSGPTRS", MENU_RESETPOINTERS}, + {"RESETALLMSGPTRS", MENU_RESETALLPOINTERS}, + {"FILESCAN", MENU_FILESCAN}, + {"FULLMAILSCAN", MENU_FULLMAILSCAN}, + {"FILESEARCH", MENU_FILESEARCH}, + {"DISPLAYTXTFILE", MENU_DISPTXTFILE}, + {"DISPLAYTXTPAUSE", MENU_DISPTXTFILEPAUSE}, + {"GENWWWURLS", MENU_GENWWWURLS}, + {"NLBROWSER", MENU_NLBROWSER}, + {"SENDFEEDBACK", MENU_SENDFEEDBACK}, + {"BLOGDISPLAY", MENU_BLOGDISPLAY}, + {"BLOGWRITE", MENU_BLOGWRITE}}; -#define ARRAY_SIZE(A) (sizeof(A)/sizeof((A)[0])) +#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0])) int cmd2cmd(const char *cmd) { for (size_t i = 0; i < ARRAY_SIZE(commands); ++i) diff --git a/src/users.c b/src/users.c index 3e45416..71f2479 100644 --- a/src/users.c +++ b/src/users.c @@ -103,12 +103,12 @@ int save_user(struct user_record *user) { int rc = 0; const char *update_sql = - "UPDATE users SET password=?, salt=?, firstname=?," - "lastname=?, email=?, location=?, sec_level=?, last_on=?, " - "time_left=?, cur_mail_conf=?, cur_mail_area=?, " - "cur_file_dir=?, cur_file_sub=?, times_on=?, bwavepktno=?, " - "archiver=?, protocol=?,nodemsgs=?,codepage=?,exteditor=?," - "bwavestyle=?,signature=?,autosig=? where loginname LIKE ?"; + "UPDATE users SET password=?, salt=?, firstname=?," + "lastname=?, email=?, location=?, sec_level=?, last_on=?, " + "time_left=?, cur_mail_conf=?, cur_mail_area=?, " + "cur_file_dir=?, cur_file_sub=?, times_on=?, bwavepktno=?, " + "archiver=?, protocol=?,nodemsgs=?,codepage=?,exteditor=?," + "bwavestyle=?,signature=?,autosig=? where loginname LIKE ?"; open_users_db_or_die(&db); @@ -163,7 +163,7 @@ int msgbase_flag_unflag(struct user_record *user, int conference, int msgbase, i int flagunflag = 0; static const char *create_sql = - "CREATE TABLE IF NOT EXISTS msg_flags (conference INTEGER, msgbase INTEGER, uid INTEGER, msg INTEGER);"; + "CREATE TABLE IF NOT EXISTS msg_flags (conference INTEGER, msgbase INTEGER, uid INTEGER, msg INTEGER);"; flagunflag = msgbase_is_flagged(user, conference, msgbase, msgid); @@ -181,11 +181,11 @@ int msgbase_flag_unflag(struct user_record *user, int conference, int msgbase, i } if (flagunflag == 1) { static const char *unflag_buf = - "DELETE FROM msg_flags WHERE conference=? AND msgbase=? AND uid=? AND msg=?"; + "DELETE FROM msg_flags WHERE conference=? AND msgbase=? AND uid=? AND msg=?"; rc = sqlite3_prepare_v2(db, unflag_buf, -1, &res, 0); } else { static const char *flag_buf = - "INSERT INTO msg_flags (conference, msgbase, uid, msg) VALUES(?, ?, ?, ?)"; + "INSERT INTO msg_flags (conference, msgbase, uid, msg) VALUES(?, ?, ?, ?)"; rc = sqlite3_prepare_v2(db, flag_buf, -1, &res, 0); } @@ -208,7 +208,7 @@ int msgbase_is_flagged(struct user_record *user, int conference, int msgbase, in int rc = 0; static const char *sql_buf = - "SELECT * FROM msg_flags WHERE conference=? AND msgbase=? AND uid=? AND msg=?"; + "SELECT * FROM msg_flags WHERE conference=? AND msgbase=? AND uid=? AND msg=?"; open_users_db_or_die(&db); @@ -238,7 +238,7 @@ int msgbase_sub_unsub(int conference, int msgbase) { sqlite3_stmt *res = NULL; int rc = 0; static const char *create_sql = - "CREATE TABLE IF NOT EXISTS msg_subs (conference INTEGER, msgbase INTEGER, uid INTEGER);"; + "CREATE TABLE IF NOT EXISTS msg_subs (conference INTEGER, msgbase INTEGER, uid INTEGER);"; char *err_msg = NULL; int subunsub = msgbase_is_subscribed(conference, msgbase); @@ -253,11 +253,11 @@ int msgbase_sub_unsub(int conference, int msgbase) { } if (subunsub == 1) { static char *unsub_buf = - "DELETE FROM msg_subs WHERE conference=? AND msgbase=? AND uid=?"; + "DELETE FROM msg_subs WHERE conference=? AND msgbase=? AND uid=?"; rc = sqlite3_prepare_v2(db, unsub_buf, -1, &res, 0); } else { static const char *sub_buf = - "INSERT INTO msg_subs (conference, msgbase, uid) VALUES(?, ?, ?)"; + "INSERT INTO msg_subs (conference, msgbase, uid) VALUES(?, ?, ?)"; rc = sqlite3_prepare_v2(db, sub_buf, -1, &res, 0); } @@ -279,7 +279,7 @@ int msgbase_is_subscribed(int conference, int msgbase) { int rc = 0; static const char *sql_buf = - "SELECT * FROM msg_subs WHERE conference=? AND msgbase=? AND uid=?"; + "SELECT * FROM msg_subs WHERE conference=? AND msgbase=? AND uid=?"; open_users_db_or_die(&db); @@ -311,40 +311,40 @@ int inst_user(struct user_record *user) { int rc = 0; static const char *create_sql = - "CREATE TABLE IF NOT EXISTS users (" - "Id INTEGER PRIMARY KEY," - "loginname TEXT COLLATE NOCASE," - "password TEXT," - "salt TEXT," - "firstname TEXT," - "lastname TEXT," - "email TEXT," - "location TEXT," - "sec_level INTEGER," - "last_on INTEGER," - "time_left INTEGER," - "cur_mail_conf INTEGER," - "cur_mail_area INTEGER," - "cur_file_sub INTEGER," - "cur_file_dir INTEGER," - "times_on INTEGER," - "bwavepktno INTEGER," - "archiver INTEGER," - "protocol INTEGER," - "nodemsgs INTEGER," - "codepage INTEGER," - "exteditor INTEGER," - "bwavestyle INTEGER," - "signature TEXT," - "autosig INTEGER);"; + "CREATE TABLE IF NOT EXISTS users (" + "Id INTEGER PRIMARY KEY," + "loginname TEXT COLLATE NOCASE," + "password TEXT," + "salt TEXT," + "firstname TEXT," + "lastname TEXT," + "email TEXT," + "location TEXT," + "sec_level INTEGER," + "last_on INTEGER," + "time_left INTEGER," + "cur_mail_conf INTEGER," + "cur_mail_area INTEGER," + "cur_file_sub INTEGER," + "cur_file_dir INTEGER," + "times_on INTEGER," + "bwavepktno INTEGER," + "archiver INTEGER," + "protocol INTEGER," + "nodemsgs INTEGER," + "codepage INTEGER," + "exteditor INTEGER," + "bwavestyle INTEGER," + "signature TEXT," + "autosig INTEGER);"; static const char *insert_sql = - "INSERT INTO users (loginname, password, salt, firstname," - "lastname, email, location, sec_level, last_on, time_left, " - "cur_mail_conf, cur_mail_area, cur_file_dir, cur_file_sub, " - "times_on, bwavepktno, archiver, protocol, nodemsgs, " - "codepage, exteditor, bwavestyle, signature, autosig) " - "VALUES(?,?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + "INSERT INTO users (loginname, password, salt, firstname," + "lastname, email, location, sec_level, last_on, time_left, " + "cur_mail_conf, cur_mail_area, cur_file_dir, cur_file_sub, " + "times_on, bwavepktno, archiver, protocol, nodemsgs, " + "codepage, exteditor, bwavestyle, signature, autosig) " + "VALUES(?,?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; open_users_db_or_die(&db); @@ -410,12 +410,12 @@ struct user_record *check_user_pass(char *loginname, char *password) { char pathbuf[PATH_MAX]; static const char *sql = - "SELECT Id, loginname, password, salt, firstname," - "lastname, email, location, sec_level, last_on, time_left, " - "cur_mail_conf, cur_mail_area, cur_file_dir, cur_file_sub, " - "times_on, bwavepktno, archiver, protocol,nodemsgs, " - "codepage, exteditor, bwavestyle, signature, autosig " - "FROM users WHERE loginname LIKE ?"; + "SELECT Id, loginname, password, salt, firstname," + "lastname, email, location, sec_level, last_on, time_left, " + "cur_mail_conf, cur_mail_area, cur_file_dir, cur_file_sub, " + "times_on, bwavepktno, archiver, protocol,nodemsgs, " + "codepage, exteditor, bwavestyle, signature, autosig " + "FROM users WHERE loginname LIKE ?"; open_users_db_or_die(&db); rc = sqlite3_prepare_v2(db, sql, -1, &res, 0); @@ -546,7 +546,7 @@ int check_fullname(char *firstname, char *lastname) { int rc = 0; static const char *sql = - "SELECT * FROM users WHERE firstname = ? AND lastname = ?"; + "SELECT * FROM users WHERE firstname = ? AND lastname = ?"; open_users_db_or_die(&db); rc = sqlite3_prepare_v2(db, sql, -1, &res, 0); diff --git a/src/www_files.c b/src/www_files.c index af95024..260846c 100644 --- a/src/www_files.c +++ b/src/www_files.c @@ -273,7 +273,7 @@ char *www_create_link(int dir, int sub, int fid) { hashid = (char *)malloz(sizereq + 1); if (hashids_encode_v(hashids, hashid, 4, (unsigned long long)gUser->id, - (unsigned long long)dir, (unsigned long long)sub, (unsigned long long)fid) == 0) { + (unsigned long long)dir, (unsigned long long)sub, (unsigned long long)fid) == 0) { hashids_free(hashids); free(hashid); return NULL;