X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/37f237ba3f386597b2dfec0c5369892d9478c70c..0f3e9cfc4b5d0f13085c975e10c0e6c4c8e5fbc3:/src/mod-helpserv.c diff --git a/src/mod-helpserv.c b/src/mod-helpserv.c index e608a93..3607446 100644 --- a/src/mod-helpserv.c +++ b/src/mod-helpserv.c @@ -1,7 +1,7 @@ /* mod-helpserv.c - Support Helper assistant service * Copyright 2002-2003 srvx Development Team * - * This file is part of srvx. + * This file is part of x3. * * srvx is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -218,6 +218,7 @@ static const struct message_entry msgtab[] = { { "HSMSG_REQ_PERSIST_PART", "Everything you tell me until you are helped (or you leave %s) will be recorded. If you part %s, your request will be lost." }, { "HSMSG_REQ_PERSIST_HANDLE", "Everything you tell me until you are helped will be recorded." }, { "HSMSG_REQ_MAXLEN", "Sorry, but your request has reached the maximum number of lines. Please wait to be assigned to a helper and continue explaining your request to them." }, + { "HSMSQ_REQ_TEXT_ADDED", "Message from $b%s:$b %s" }, { "HSMSG_REQ_FOUND_ANOTHER", "Request ID#%lu has been closed. $S detected that you also have request ID#%lu open. If you send $S a message, it will be associated with that request." }, /* Messages that are inserted into request text */ @@ -1085,7 +1086,22 @@ static void helpserv_usermsg(struct userNode *user, struct helpserv_bot *hs, cha req->updated = now; if (!hs->req_maxlen || req->text->used < hs->req_maxlen) + { string_list_append(req->text, strdup(text)); + + struct userNode *likely_helper; + /* Find somebody likely to be the helper */ + if (!req->helper) + likely_helper = NULL; + else if ((likely_helper = req->helper->handle->users) && !likely_helper->next_authed) { + /* only one user it could be :> */ + } else for (likely_helper = req->helper->handle->users; likely_helper; likely_helper = likely_helper->next_authed) + if (GetUserMode(hs->helpchan, likely_helper)) + break; + + if(likely_helper) + send_target_message(1, likely_helper->nick, hs->helpserv, "HSMSQ_REQ_TEXT_ADDED", user->nick, text); + } else helpserv_msguser(user, "HSMSG_REQ_MAXLEN"); } @@ -1413,7 +1429,8 @@ static int show_helper_range(struct userNode *user, struct helpserv_bot *hs, int } qsort(users.list, users.used, sizeof(users.list[0]), helpserv_user_comp); switch (user->handle_info->userlist_style) { - case HI_STYLE_DEF: + default: + case HI_STYLE_NORMAL: tbl.length = users.used + 1; tbl.width = 3; tbl.flags = TABLE_NO_FREE; @@ -1431,6 +1448,7 @@ static int show_helper_range(struct userNode *user, struct helpserv_bot *hs, int } table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); break; + /* case HI_STYLE_ZOOT: default: last_level = HlNone; tbl.length = 0; @@ -1454,6 +1472,7 @@ static int show_helper_range(struct userNode *user, struct helpserv_bot *hs, int helpserv_notice(user, "HSMSG_USERLIST_ZOOT_LVL", hs->helpserv->nick, helpserv_level_names[last_level]); table_send((from_opserv ? opserv : hs->helpserv), user->nick, 0, NULL, tbl); } + */ } return 1; } @@ -1550,7 +1569,7 @@ static void free_request(void *data) { /* Logging */ if (shutting_down && (req->hs->persist_types[PERSIST_T_REQUEST] != PERSIST_CLOSE || !req->handle)) { - helpserv_log_request(req, "srvx shutdown"); + helpserv_log_request(req, "X3 shutdown"); } /* Clean up from the unhandled queue */ @@ -3648,7 +3667,7 @@ static void helpserv_conf_read(void) { helpserv_conf.db_backup_frequency = str ? ParseInterval(str) : 7200; str = database_get_data(conf_node, "description", RECDB_QSTRING); - helpserv_conf.description = str; + helpserv_conf.description = str ? str : "Help Queue Manager"; str = database_get_data(conf_node, "reqlogfile", RECDB_QSTRING); if (str && strlen(str))