enum notification_type notify;
/* This is a default; it can be changed on a per-request basis */
- enum persistence_type persist_types[PERSIST_T_COUNT];
+ enum persistence_length persist_lengths[PERSIST_T_COUNT];
dict_t users; /* indexed by handle */
fmt = user_find_message(user, "HSMSG_REQ_NO_UNHANDLED");
sprintf(lbuf[1], "%s", fmt);
}
- switch (hs->persist_types[PERSIST_T_REQUEST]) {
+ switch (hs->persist_lengths[PERSIST_T_REQUEST]) {
case PERSIST_PART:
fmt = user_find_message(user, "HSMSG_REQ_PERSIST_PART");
sprintf(lbuf[2], fmt, hs->helpchan->name, hs->helpchan->name);
helpserv_msguser(user, "HSMSG_USERCMD_NO_REQUEST");
return;
}
- if ((hs->persist_types[PERSIST_T_REQUEST] == PERSIST_PART) && !GetUserMode(hs->helpchan, user)) {
+ if ((hs->persist_lengths[PERSIST_T_REQUEST] == PERSIST_PART) && !GetUserMode(hs->helpchan, user)) {
helpserv_msguser(user, "HSMSG_REQ_YOU_NOT_IN_HELPCHAN_OPEN", hs->helpchan->name);
return;
}
struct helpserv_request *req = data;
/* Logging */
- if (shutting_down && (req->hs->persist_types[PERSIST_T_REQUEST] != PERSIST_CLOSE || !req->handle)) {
+ if (shutting_down && (req->hs->persist_lengths[PERSIST_T_REQUEST] != PERSIST_CLOSE || !req->handle)) {
helpserv_log_request(req, "srvx shutdown");
}
if (!user->handle_info)
return 0;
- if ((hs->persist_types[PERSIST_T_HELPER] == PERSIST_PART) && !GetUserMode(hs->helpchan, user)) {
+ if ((hs->persist_lengths[PERSIST_T_HELPER] == PERSIST_PART) && !GetUserMode(hs->helpchan, user)) {
struct helpserv_user *hsuser_actor = GetHSUser(hs, actor->handle_info);
if (hsuser_actor->level < HlManager) {
helpserv_notice(user, "HSMSG_REQ_YOU_NOT_IN_HELPCHAN", hs->helpchan->name);
return 0;
}
- if ((hs->persist_types[PERSIST_T_HELPER] == PERSIST_PART) && !GetUserMode(hs->helpchan, user) && (hs_user->level < HlManager)) {
+ if ((hs->persist_lengths[PERSIST_T_HELPER] == PERSIST_PART) && !GetUserMode(hs->helpchan, user) && (hs_user->level < HlManager)) {
helpserv_notice(user, "HSMSG_REQ_HIM_NOT_IN_HELPCHAN", targetuser->nick, hs->helpchan->name);
return 0;
}
helpserv_notice(user, "HSMSG_INVALID_OPTION", argv[0]);
return 0;
}
- hs->persist_types[idx] = new_pers;
+ hs->persist_lengths[idx] = new_pers;
changed = 1;
}
- helpserv_notice(user, persistence_types[idx].print_name,
- user_find_message(user, persistence_lengths[hs->persist_types[idx]].print_name));
+ helpserv_notice(user, persistence_lengths[idx].print_name,
+ user_find_message(user, persistence_lengths[hs->persist_lengths[idx]].print_name));
return changed;
}
saxdb_end_record(ctx);
/* Open requests */
- if (hs->persist_types[PERSIST_T_REQUEST] == PERSIST_CLOSE) {
+ if (hs->persist_lengths[PERSIST_T_REQUEST] == PERSIST_CLOSE) {
saxdb_start_record(ctx, KEY_REQUESTS, 0);
dict_foreach(hs->requests, request_write_helper, ctx);
saxdb_end_record(ctx);
saxdb_write_int(ctx, interval_types[inttype].db_name, hs->intervals[inttype]);
}
for (persisttype=0; persisttype<PERSIST_T_COUNT; persisttype++) {
- const char *persist = persistence_lengths[hs->persist_types[persisttype]].db_name;
+ const char *persist = persistence_lengths[hs->persist_lengths[persisttype]].db_name;
saxdb_write_string(ctx, persistence_types[persisttype].db_name, persist);
}
saxdb_write_string(ctx, KEY_NOTIFICATION, notification_types[hs->notify].db_name);
for (persisttype=0; persisttype<PERSIST_T_COUNT; persisttype++) {
str = database_get_data(GET_RECORD_OBJECT(br), persistence_types[persisttype].db_name, RECDB_QSTRING);
- hs->persist_types[persisttype] = str ? persistence_from_name(str) : PERSIST_QUIT;
+ hs->persist_lengths[persisttype] = str ? persistence_from_name(str) : PERSIST_QUIT;
}
str = database_get_data(GET_RECORD_OBJECT(br), KEY_NOTIFICATION, RECDB_QSTRING);
hs->notify = str ? notification_from_name(str) : NOTIFY_NONE;
hs = botlist->list[i];
if (!hs->helpserv)
continue;
- if (hs->persist_types[PERSIST_T_REQUEST] != PERSIST_PART)
+ if (hs->persist_lengths[PERSIST_T_REQUEST] != PERSIST_PART)
continue;
for (it=dict_first(hs->requests); it; it=iter_next(it)) {
for (it=dict_first(hs->requests); it; it=iter_next(it)) {
struct helpserv_request *req=iter_data(it);
- if ((hs->persist_types[PERSIST_T_HELPER] == PERSIST_PART)
+ if ((hs->persist_lengths[PERSIST_T_HELPER] == PERSIST_PART)
&& (req->helper == hs_user)) {
char our_reason[CHANNELLEN + 8];
sprintf(our_reason, "parted %s", mn->channel->name);
for (i=0; i < n; i++) {
struct helpserv_request *req = reqlist->list[0];
- if ((req->hs->persist_types[PERSIST_T_REQUEST] == PERSIST_QUIT) || !req->handle) {
+ if ((req->hs->persist_lengths[PERSIST_T_REQUEST] == PERSIST_QUIT) || !req->handle) {
char buf[12];
sprintf(buf, "%lu", req->id);
for (it=dict_first(hs->requests); it; it=iter_next(it)) {
struct helpserv_request *req=iter_data(it);
- if ((hs->persist_types[PERSIST_T_HELPER] == PERSIST_QUIT) && (req->helper == hs_user)) {
+ if ((hs->persist_lengths[PERSIST_T_HELPER] == PERSIST_QUIT) && (req->helper == hs_user)) {
helpserv_page_helper_gone(hs, req, "disconnected");
}
}
struct helpserv_request *req = reqlist->list[i];
struct helpserv_bot *hs=req->hs;
- if (!old_handle || hs->persist_types[PERSIST_T_REQUEST] == PERSIST_PART || hs->persist_types[PERSIST_T_REQUEST] == PERSIST_QUIT) {
+ if (!old_handle || hs->persist_lengths[PERSIST_T_REQUEST] == PERSIST_PART || hs->persist_lengths[PERSIST_T_REQUEST] == PERSIST_QUIT) {
/* The request needs to be assigned to the new handle; either it
* only persists until part/quit (so it makes sense to keep it as
* close to the user as possible, and if it's made persistent later
if (old_handle) {
char buf[CHANNELLEN + 14];
- if (hs->persist_types[PERSIST_T_REQUEST] == PERSIST_PART) {
+ if (hs->persist_lengths[PERSIST_T_REQUEST] == PERSIST_PART) {
sprintf(buf, "part channel %s", hs->helpchan->name);
} else {
strcpy(buf, "quit irc");
}
helpserv_reqlist_append(req->parent_nick_list, req);
- if (hs->persist_types[PERSIST_T_REQUEST] == PERSIST_CLOSE)
+ if (hs->persist_lengths[PERSIST_T_REQUEST] == PERSIST_CLOSE)
helpserv_msguser(req->user, "HSMSG_REQ_WARN_UNREG", handle->handle, hs->helpchan->name, req->id);
} else {
if (handle->users) {