[srvx-commits] CVS: services/src helpserv.c,1.53,1.54 helpserv.help,1.15,1.16
Brought to you by:
entrope
|
From: Adrian D. <sai...@us...> - 2002-12-01 00:38:09
|
Update of /cvsroot/srvx/services/src
In directory sc8-pr-cvs1:/tmp/cvs-serv9425
Modified Files:
helpserv.c helpserv.help
Log Message:
Add trivial feature to HelpServ: auto(de)voice
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** helpserv.c 29 Nov 2002 02:03:49 -0000 1.53
--- helpserv.c 1 Dec 2002 00:38:06 -0000 1.54
***************
*** 20,23 ****
--- 20,24 ----
/* TODO List for helpserv.c
+ * (empty)
* Wishlist for helpserv.c
* - Statistical analysis of time (define what this means first)
***************
*** 94,97 ****
--- 95,100 ----
#define KEY_PRIVMSG_ONLY "privmsg_only"
#define KEY_REQ_ON_JOIN "req_on_join"
+ #define KEY_AUTO_VOICE "auto_voice"
+ #define KEY_AUTO_DEVOICE "auto_devoice"
/* General */
***************
*** 420,423 ****
--- 423,428 ----
unsigned int privmsg_only : 1;
unsigned int req_on_join : 1;
+ unsigned int auto_voice : 1;
+ unsigned int auto_devoice : 1;
unsigned int helpchan_empty : 1;
***************
*** 1392,1395 ****
--- 1397,1401 ----
struct helpserv_reqlist *nick_list, *hand_list;
struct helpserv_user *hs_user=GetHSUser(hs, user->handle_info);
+ struct userNode *req_user=NULL;
char close_reason[MAXLEN];
unsigned long old_req;
***************
*** 1413,1419 ****
}
! if (req->user) helpserv_message(hs, req->user, MSGTYPE_REQ_CLOSED);
helpserv_notice(user, HSMSG_REQ_CLOSED, req->id);
! helpserv_page(PGSRC_STATUS, HSMSG_PAGE_CLOSE_REQUEST, req->id, req->user ? req->user->nick : "an offline user", req->handle ? req->handle->handle : "not authed", user->nick);
hs_user->closed[0]++;
--- 1419,1428 ----
}
! if (req->user) {
! req_user = req->user;
! helpserv_message(hs, req_user, MSGTYPE_REQ_CLOSED);
! }
helpserv_notice(user, HSMSG_REQ_CLOSED, req->id);
! helpserv_page(PGSRC_STATUS, HSMSG_PAGE_CLOSE_REQUEST, req->id, req_user ? req_user->nick : "an offline user", req->handle ? req->handle->handle : "not authed", user->nick);
hs_user->closed[0]++;
***************
*** 1454,1457 ****
--- 1463,1473 ----
}
+ if (req_user && hs->auto_devoice) {
+ struct modeNode *mn=GetUserMode(hs->helpchan, req_user);
+ if ((!newest || !newest->helper) && mn && (mn->modes & MODE_VOICE)) {
+ DelChannelVoice(1, &req_user, hs->helpchan, hs->helpserv, 1);
+ }
+ }
+
return 1;
}
***************
*** 1627,1630 ****
--- 1643,1652 ----
}
helpserv_page(PGSRC_STATUS, HSMSG_PAGE_ASSIGN_REQUEST, req->id, req->user ? req->user->nick : "an offline user", req->handle ? req->handle->handle : "not authed", user->nick);
+
+ if (req->user && hs->auto_voice) {
+ struct modeNode *mn=GetUserMode(hs->helpchan, req->user);
+ if (mn && !(mn->modes & MODE_VOICE)) AddChannelVoice(1, &req->user, hs->helpchan, hs->helpserv, 1);
+ }
+
return 1;
}
***************
*** 2080,2084 ****
--- 2102,2111 ----
/* Let the user know that their request is now unhandled */
if (req->user) {
+ struct modeNode *mn=GetUserMode(hs->helpchan, req->user);
+
helpserv_msguser(req->user, HSMSG_REQ_UNASSIGNED, req->id, reason);
+ if (hs->auto_devoice && mn && (mn->modes & MODE_VOICE)) {
+ DelChannelVoice(1, &req->user, hs->helpchan, hs->helpserv, 1);
+ }
}
***************
*** 2771,2774 ****
--- 2798,2809 ----
}
+ static HELPSERV_OPTION(opt_auto_voice) {
+ OPTION_BINARY(hs->auto_voice, "AutoVoice");
+ }
+
+ static HELPSERV_OPTION(opt_auto_devoice) {
+ OPTION_BINARY(hs->auto_devoice, "AutoDeVoice");
+ }
+
static HELPSERV_FUNC(cmd_set) {
helpserv_option_func_t *opt;
***************
*** 2783,2787 ****
opt_empty_interval, opt_stale_delay, opt_request_persistence,
opt_helper_persistence, opt_notification, opt_id_wrap,
! opt_req_maxlen, opt_privmsg_only, opt_req_on_join
};
--- 2818,2823 ----
opt_empty_interval, opt_stale_delay, opt_request_persistence,
opt_helper_persistence, opt_notification, opt_id_wrap,
! opt_req_maxlen, opt_privmsg_only, opt_req_on_join, opt_auto_voice,
! opt_auto_devoice
};
***************
*** 3068,3071 ****
--- 3104,3109 ----
saxdb_write_int(ctx, KEY_PRIVMSG_ONLY, hs->privmsg_only);
saxdb_write_int(ctx, KEY_REQ_ON_JOIN, hs->req_on_join);
+ saxdb_write_int(ctx, KEY_AUTO_VOICE, hs->auto_voice);
+ saxdb_write_int(ctx, KEY_AUTO_DEVOICE, hs->auto_devoice);
/* End bot record */
***************
*** 3171,3174 ****
--- 3209,3216 ----
str = database_get_data(GET_RECORD_OBJECT(br), KEY_REQ_ON_JOIN, RECDB_QSTRING);
hs->req_on_join = str ? enabled_string(str) : 0;
+ str = database_get_data(GET_RECORD_OBJECT(br), KEY_AUTO_VOICE, RECDB_QSTRING);
+ hs->auto_voice = str ? enabled_string(str) : 0;
+ str = database_get_data(GET_RECORD_OBJECT(br), KEY_AUTO_DEVOICE, RECDB_QSTRING);
+ hs->auto_devoice = str ? enabled_string(str) : 0;
dict_foreach(users, user_read_helper, hs);
***************
*** 3405,3408 ****
--- 3447,3451 ----
struct helpserv_reqlist *reqlist, *hand_reqlist=NULL;
struct helpserv_request *newest=NULL, *nicknewest=NULL;
+ struct modeNode *mn;
unsigned int i;
const int from_opserv = 0; /* For helpserv_notice */
***************
*** 3460,3463 ****
--- 3503,3510 ----
nicknewest = req;
}
+
+ if (hs->auto_voice && req->helper && (mn = GetUserMode(hs->helpchan, user)) && !(mn->modes & MODE_VOICE)) {
+ AddChannelVoice(1, &user, hs->helpchan, hs->helpserv, 1);
+ }
}
***************
*** 4063,4066 ****
--- 4110,4115 ----
helpserv_define_option("PRIVMSGONLY", opt_privmsg_only);
helpserv_define_option("REQONJOIN", opt_req_on_join);
+ helpserv_define_option("AUTOVOICE", opt_auto_voice);
+ helpserv_define_option("AUTODEVOICE", opt_auto_devoice);
helpserv_bots_dict = dict_new();
Index: helpserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.help,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** helpserv.help 9 Nov 2002 03:46:39 -0000 1.15
--- helpserv.help 1 Dec 2002 00:38:06 -0000 1.16
***************
*** 141,144 ****
--- 141,146 ----
"PrivmsgOnly Messages to users are sent as privmsg (overriding account preference)",
"ReqOnJoin Automatically opens a request for a user who joins the channel",
+ "AutoVoice Automatically voices users when their request is assigned to a helper",
+ "AutoDeVoice Automatically devoices users when their request is closed or their helper is unassigned",
"$uSee also:$u set <option-name>");
"SET PAGETARGET" ("$bSET PAGETARGET$b",
|