#include "bot_NeonHelp.h"
#include "modcmd.h"
#include "cmd_neonhelp.h"
+#include "lang.h"
#include "mysqlConn.h"
#include "ClientSocket.h"
#include "UserNode.h"
#include "IRCParser.h"
#include "bots.h"
#include "DBHelper.h"
+#include "WHOHandler.h"
#define BOTID 4
#define BOTALIAS "NeonHelp"
{"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."},
}
}
-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);
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) {
#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
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;
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)
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) {
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);
#include "cmd_neonserv.h"
#include "cmd_neonspam.h"
#include "cmd_funcmds.h"
+#include "cmd_neonhelp.h"
#include "modcmd.h"
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);