From: pk910 Date: Wed, 4 Jan 2012 22:44:28 +0000 (+0100) Subject: fixed #989cb8324ec8fe9caba511d89051552638dbc776 X-Git-Tag: v5.3~84 X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=a89e43dcd199882ca605c6a7038e816a3bcfaa1a fixed #989cb8324ec8fe9caba511d89051552638dbc776 --- diff --git a/src/bot_NeonHelp.c b/src/bot_NeonHelp.c index 1ff01cc..506a797 100644 --- a/src/bot_NeonHelp.c +++ b/src/bot_NeonHelp.c @@ -18,6 +18,7 @@ #include "bot_NeonHelp.h" #include "modcmd.h" #include "cmd_neonhelp.h" +#include "lang.h" #include "mysqlConn.h" #include "ClientSocket.h" #include "UserNode.h" @@ -27,6 +28,7 @@ #include "IRCParser.h" #include "bots.h" #include "DBHelper.h" +#include "WHOHandler.h" #define BOTID 4 #define BOTALIAS "NeonHelp" @@ -38,8 +40,8 @@ static const struct default_language_entry msgtab[] = { {"NH_REQUEST_OTHERS_0", "There are no other unhandled requests."}, {"NH_REQUEST_OTHERS_1", "There is 1 other unhandled request."}, {"NH_REQUEST_OTHERS_2", "There are %d other unhandled requests."}, /* {ARGS: 1337} */ - {"NH_REQUEST_FOOTER_1", "Everything you tell me until you are helped (or you leave %s) will be recorded. If you part %s, your request will be lost."}, /* {ARGS: "#test"} */ - {"NH_REQUEST_FOOTER_2", "Everything you tell me until you are helped (or you leave %s or %s) will be recorded. If you part %s or %s, your request will be lost."}, /* {ARGS: "#test", "#test-support"} */ + {"NH_REQUEST_FOOTER_1", "Everything you tell me until you are helped (or you leave %1$s) will be recorded. If you part %1$s, your request will be lost."}, /* {ARGS: "#test"} */ + {"NH_REQUEST_FOOTER_2", "Everything you tell me until you are helped (or you leave %1$s or %2$s) will be recorded. If you part %1$s or %2$s, your request will be lost."}, /* {ARGS: "#test", "#test-support"} */ {"NH_NEW_REQUEST", "New request #%d by %s: %s"}, /* {ARGS: 5, "pk910", "Help, I've fallen and I can't get up!"} */ {"NH_NEXT_NONE", "No more requests."}, {"NH_NEXT_NOT_FOUND", "No request found."}, @@ -267,9 +269,9 @@ static void neonhelp_event_privmsg_async(struct ClientSocket *client, struct Use } } -static void destroy_support_request(struct ClientSocket *client, struct NeonHelpNode *helpnode, int reply) { +static void destroy_support_request(struct ClientSocket *client, struct NeonHelpNode *helpnode, int do_reply) { printf_mysql_query("UPDATE `helpserv_requests` SET `status` = '2' WHERE `id` = %d", helpnode->suppid); - if(reply) { + if(do_reply) { reply(client, helpnode->user, "NH_DELETED", helpnode->suppid); } free(helpnode); @@ -351,9 +353,6 @@ static void neonhelp_event_part(struct ChanUser *target, char *reason) { static void neonhelp_event_quit(struct UserNode *target, char *reason) { struct ClientSocket *client; - MYSQL_RES *res; - MYSQL_ROW row; - struct ChanNode *support, *public; int userHasRequest; for(client = getBots(SOCKET_FLAG_READY, NULL); client; client = getBots(SOCKET_FLAG_READY, client)) { if(client->botid == BOTID) { diff --git a/src/cmd_neonhelp.h b/src/cmd_neonhelp.h index 5f61657..5993886 100644 --- a/src/cmd_neonhelp.h +++ b/src/cmd_neonhelp.h @@ -18,7 +18,17 @@ #define _cmd_neonhelp_h #include "main.h" #include "modcmd.h" +#include "mysqlConn.h" +#include "ClientSocket.h" +#include "UserNode.h" +#include "ChanNode.h" +#include "ChanUser.h" +#include "DBHelper.h" +#include "IRCParser.h" +#include "bot_NeonHelp.h" +#include "lang.h" +CMD_BIND(neonhelp_cmd_delete); CMD_BIND(neonhelp_cmd_next); #endif \ No newline at end of file diff --git a/src/cmd_neonhelp_delete.c b/src/cmd_neonhelp_delete.c index 3f589d5..43d5829 100644 --- a/src/cmd_neonhelp_delete.c +++ b/src/cmd_neonhelp_delete.c @@ -61,7 +61,6 @@ CMD_BIND(neonhelp_cmd_delete) { return; } struct NeonHelpNode *helpnode, *next_helpnode = NULL, *prev_helpnode = NULL; - int lowest_id = -1; for(helpnode = client->botclass_helpnode; helpnode; helpnode = helpnode->next) { if(atoi(argv[0]) == helpnode->suppid) { next_helpnode = helpnode; @@ -73,7 +72,6 @@ CMD_BIND(neonhelp_cmd_delete) { reply(getTextBot(), user, "NH_NEXT_NOT_FOUND"); return; } - char sendbuf[MAXLEN]; reply(client, next_helpnode->user, "NH_DELETED", next_helpnode->suppid); printf_mysql_query("UPDATE `helpserv_requests` SET `status` = '2' WHERE `id` = '%d'", next_helpnode->suppid); if(prev_helpnode) diff --git a/src/cmd_neonhelp_next.c b/src/cmd_neonhelp_next.c index 666b1a5..4cb7ee3 100644 --- a/src/cmd_neonhelp_next.c +++ b/src/cmd_neonhelp_next.c @@ -87,7 +87,7 @@ CMD_BIND(neonhelp_cmd_next) { reply(getTextBot(), user, "NH_NEXT_HEADER", next_helpnode->suppid, next_helpnode->user->nick); char *a, *b = row2[0]; do { - a = strstr("\n", b); + a = strstr(b, "\n"); if(a) *a = '\0'; reply(getTextBot(), user, " %s", b); if(a) { @@ -101,7 +101,7 @@ CMD_BIND(neonhelp_cmd_next) { putsock(client, "MODE %s +v %s", row[0], next_helpnode->user->nick); char sendbuf1[MAXLEN]; char sendbuf2[MAXLEN]; - char *join_now = (row[1] ? build_language_string(user, sendbuf2, "NH_NEXT_JOIN", row[1]) : ""); + char *join_now = (row[1] ? build_language_string(user, sendbuf2, "NH_NEXT_JOIN", row[0]) : ""); putsock(client, "PRIVMSG %s :%s %s", next_helpnode->user->nick, build_language_string(user, sendbuf1, "NH_NEXT_HELPER", next_helpnode->suppid, user->auth, user->nick), join_now); next_helpnode->status = 1; printf_mysql_query("UPDATE `helpserv_requests` SET `status` = '1' WHERE `id` = '%d'", next_helpnode->suppid); diff --git a/src/commands.c b/src/commands.c index 5ea34ec..fcfe78b 100644 --- a/src/commands.c +++ b/src/commands.c @@ -19,6 +19,7 @@ #include "cmd_neonserv.h" #include "cmd_neonspam.h" #include "cmd_funcmds.h" +#include "cmd_neonhelp.h" #include "modcmd.h" void register_commands() { @@ -157,7 +158,7 @@ void register_commands() { //NeonHelp Commands register_command_alias(4, "NeonHelp"); - #define USER_COMMAND(NAME,FUNCTION,PARAMCOUNT,PRIVS,FLAGS) register_command(2, NAME, FUNCTION, PARAMCOUNT, PRIVS, 0, FLAGS) + #define USER_COMMAND(NAME,FUNCTION,PARAMCOUNT,PRIVS,FLAGS) register_command(4, NAME, FUNCTION, PARAMCOUNT, PRIVS, 0, FLAGS) // NAME FUNCTION PARAMS PRIVS FLAGS USER_COMMAND("next", neonhelp_cmd_next, 0, NULL, CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH); USER_COMMAND("delete", neonhelp_cmd_delete, 1, NULL, CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH);