Thread: [srvx-commits] CVS: services/src helpserv.c,1.46,1.47 helpserv.help,1.13,1.14
Brought to you by:
entrope
|
From: Adrian D. <sai...@us...> - 2002-11-07 02:05:50
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv19544
Modified Files:
helpserv.c helpserv.help
Log Message:
Add set option ReqMaxLen -- the maximum number of lines allowed in a request
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -r1.46 -r1.47
*** helpserv.c 4 Nov 2002 04:28:22 -0000 1.46
--- helpserv.c 7 Nov 2002 02:05:47 -0000 1.47
***************
*** 71,74 ****
--- 71,75 ----
#define KEY_REGISTRAR "registrar"
#define KEY_IDWRAP "id_wrap"
+ #define KEY_REQ_MAXLEN "req_maxlen"
#define KEY_LAST_REQUESTID "last_requestid"
#define KEY_HELPERS "users"
***************
*** 177,180 ****
--- 178,182 ----
#define 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."
#define HSMSG_REQ_PERSIST_HANDLE "Everything you tell me until you are helped will be recorded."
+ #define 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."
#define 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."
***************
*** 402,405 ****
--- 404,408 ----
unsigned long last_requestid;
unsigned long id_wrap;
+ unsigned long req_maxlen; /* Maxmimum request length in lines */
unsigned int privmsg_only : 1;
***************
*** 819,823 ****
req = create_request(user, hs, 0);
helpserv_page(PGSRC_STATUS, HSMSG_PAGE_NEW_REQUEST, req->id, user->nick, user->handle_info ? user->handle_info->handle : "not authed");
! } else if (hs->intervals[INTERVAL_STALE_DELAY] && (req->updated < TIME_T_CAST(now - hs->intervals[INTERVAL_STALE_DELAY]))) {
char buf[MAX_LINE_SIZE], updatestr[INTERVALLEN], timestr[MAX_LINE_SIZE];
strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&req->opened));
--- 822,826 ----
req = create_request(user, hs, 0);
helpserv_page(PGSRC_STATUS, HSMSG_PAGE_NEW_REQUEST, req->id, user->nick, user->handle_info ? user->handle_info->handle : "not authed");
! } else if (hs->intervals[INTERVAL_STALE_DELAY] && (req->updated < TIME_T_CAST(now - hs->intervals[INTERVAL_STALE_DELAY])) && (!hs->req_maxlen || req->text->used < hs->req_maxlen)) {
char buf[MAX_LINE_SIZE], updatestr[INTERVALLEN], timestr[MAX_LINE_SIZE];
strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&req->opened));
***************
*** 834,838 ****
req->updated = now;
! string_list_append(req->text, strdup(text));
}
--- 837,845 ----
req->updated = now;
! if (!hs->req_maxlen || req->text->used < hs->req_maxlen) {
! string_list_append(req->text, strdup(text));
! } else {
! helpserv_msguser(user, HSMSG_REQ_MAXLEN);
! }
}
***************
*** 2666,2677 ****
}
static HELPSERV_OPTION(opt_id_wrap) {
! int changed=0;
! if (argc > 0) {
! hs->id_wrap = strtoul(argv[0], NULL, 0);
! changed = 1;
! }
! helpserv_notice(user, HSMSG_INTEGER_VALUE, "IDWrap", hs->id_wrap);
! return changed;
}
--- 2673,2693 ----
}
+ #define OPTION_UINT(var, name) do { \
+ int changed=0; \
+ \
+ if (argc > 0) { \
+ (var) = strtoul(argv[0], NULL, 0); \
+ changed = 1; \
+ } \
+ helpserv_notice(user, HSMSG_INTEGER_VALUE, (name), (var)); \
+ return changed; \
+ } while (0);
+
static HELPSERV_OPTION(opt_id_wrap) {
! OPTION_UINT(hs->id_wrap, "IDWrap");
! }
!
! static HELPSERV_OPTION(opt_req_maxlen) {
! OPTION_UINT(hs->req_maxlen, "ReqMaxLen");
}
***************
*** 2716,2720 ****
opt_empty_interval, opt_stale_delay, opt_request_persistence,
opt_helper_persistence, opt_notification, opt_id_wrap,
! opt_privmsg_only, opt_req_on_join
};
--- 2732,2736 ----
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
};
***************
*** 2990,2993 ****
--- 3006,3010 ----
saxdb_write_int(ctx, KEY_REGISTERED, hs->registered);
saxdb_write_int(ctx, KEY_IDWRAP, hs->id_wrap);
+ saxdb_write_int(ctx, KEY_REQ_MAXLEN, hs->req_maxlen);
saxdb_write_int(ctx, KEY_LAST_REQUESTID, hs->last_requestid);
if (hs->registrar) saxdb_write_string(ctx, KEY_REGISTRAR, hs->registrar);
***************
*** 3089,3092 ****
--- 3106,3111 ----
str = database_get_data(GET_RECORD_OBJECT(br), KEY_IDWRAP, RECDB_QSTRING);
if (str) hs->id_wrap = strtoul(str, NULL, 0);
+ str = database_get_data(GET_RECORD_OBJECT(br), KEY_REQ_MAXLEN, RECDB_QSTRING);
+ if (str) hs->req_maxlen = strtoul(str, NULL, 0);
str = database_get_data(GET_RECORD_OBJECT(br), KEY_LAST_REQUESTID, RECDB_QSTRING);
if (str) hs->last_requestid = strtoul(str, NULL, 0);
***************
*** 3913,3916 ****
--- 3932,3936 ----
helpserv_define_option("HELPERPERSIST", opt_helper_persistence);
helpserv_define_option("NOTIFICATION", opt_notification);
+ helpserv_define_option("REQMAXLEN", opt_req_maxlen);
helpserv_define_option("IDWRAP", opt_id_wrap);
helpserv_define_option("PRIVMSGONLY", opt_privmsg_only);
Index: helpserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.help,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** helpserv.help 5 Nov 2002 03:08:38 -0000 1.13
--- helpserv.help 7 Nov 2002 02:05:47 -0000 1.14
***************
*** 138,141 ****
--- 138,142 ----
"Notification Notification to helpers of events concerning their requests",
"IdWrap Maximum request ID plus one (IDs wrap to 0 when they reach this)",
+ "ReqMaxLen Maximum number of lines of text allowed in a request",
"PrivmsgOnly Messages to users are sent as privmsg (overriding account preference)",
"ReqOnJoin Automatically opens a request for a user who joins the channel",
|