void phaseSaitoX(Var* v, int ignore, Var* vx) { int dx = GetX(vx); int dy = GetY(vx); int x, y; int* sdt_x = V_DATA(vx); for (y = 0; y < dy; y++) { if (extract_int(v, cpos(0, y, 0, v)) == ignore) { sdt_x[cpos(0, y, 0, vx)] = 0; } else { sdt_x[cpos(0, y, 0, vx)] = INFTY; } // Forward scan for (x = 1; x < dx; x++) { if (extract_int(v, cpos(x, y, 0, v)) == ignore) { sdt_x[cpos(x, y, 0, vx)] = 0; } else { sdt_x[cpos(x, y, 0, vx)] = sum(1, sdt_x[cpos(x - 1, y, 0, vx)]); } } // Backward scan for (x = dx - 2; x >= 0; x--) { if (sdt_x[cpos(x + 1, y, 0, vx)] < sdt_x[cpos(x, y, 0, vx)]) { sdt_x[cpos(x, y, 0, vx)] = sum(1, sdt_x[cpos(x + 1, y, 0, vx)]); } } } }
int main() { parse_data(); while(T <= 10){ printf("Test %d:\n", T++); N = extract_int(); extract_string(bracets + 1); M = extract_int(); build(1, 1, N); while(M--){ operation = extract_int(); if(!operation){ printf("%s\n", !NODES[1].opening_excessive && !NODES[1].closing_excessive ? "YES" : "NO"); continue; } // flip it // and let the update propagate through segmented tree. bracets[operation] = bracets[operation] == ')' ? '(' : ')'; update(1, 1, N, operation); } } return 0; }
/* * Schedule or cancel a server shutdown */ void cmd_scdn(char *argbuf) { int new_state; int state = CIT_OK; char *Reply = "%d %d\n"; if (CtdlAccessCheck(ac_aide)) return; new_state = extract_int(argbuf, 0); if ((new_state == 2) || (new_state == 3)) { restart_server = 1; if (!running_as_daemon) { syslog(LOG_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n"); Reply = "%d %d Warning, not running in deamon mode. maybe we will come up again, but don't lean on it.\n"; state = ERROR; } restart_server = extract_int(argbuf, 0); new_state -= 2; } if ((new_state == 0) || (new_state == 1)) { ScheduledShutdown = new_state; } cprintf(Reply, state, ScheduledShutdown); }
/* * Administrative Set User Parameters */ void cmd_asup(char *cmdbuf) { struct ctdluser usbuf; char requested_user[128]; char notify[SIZ]; int np; int newax; int deleted = 0; if (CtdlAccessCheck(ac_aide)) return; extract_token(requested_user, cmdbuf, 0, '|', sizeof requested_user); if (CtdlGetUserLock(&usbuf, requested_user) != 0) { cprintf("%d No such user.\n", ERROR + NO_SUCH_USER); return; } np = num_parms(cmdbuf); if (np > 1) extract_token(usbuf.password, cmdbuf, 1, '|', sizeof usbuf.password); if (np > 2) usbuf.flags = extract_int(cmdbuf, 2); if (np > 3) usbuf.timescalled = extract_int(cmdbuf, 3); if (np > 4) usbuf.posted = extract_int(cmdbuf, 4); if (np > 5) { newax = extract_int(cmdbuf, 5); if ((newax >= AxDeleted) && (newax <= AxAideU)) { usbuf.axlevel = newax; } } if (np > 7) { usbuf.lastcall = extract_long(cmdbuf, 7); } if (np > 8) { usbuf.USuserpurge = extract_int(cmdbuf, 8); } CtdlPutUserLock(&usbuf); if (usbuf.axlevel == AxDeleted) { if (purge_user(requested_user) == 0) { deleted = 1; } } if (deleted) { snprintf(notify, SIZ, "User \"%s\" has been deleted by %s.\n", usbuf.fullname, (CC->logged_in ? CC->user.fullname : "an administrator") ); CtdlAideMessage(notify, "User Deletion Message"); } cprintf("%d Ok", CIT_OK); if (deleted) cprintf(" (%s deleted)", requested_user); cprintf("\n"); }
Var* vw_grassfire(Var* vsrc, int ignore) { size_t dx = GetX(vsrc); size_t dy = GetY(vsrc); int val; int i, j; int* dst = calloc(dx * dy, sizeof(int)); if (dst == NULL) { parse_error("Unable to allocate memory."); return (NULL); } Var* vdst = newVal(BSQ, dx, dy, 1, DV_INT32, dst); // First row j = 0; for (i = 0; i < dx; i++) { val = extract_int(vsrc, cpos(i, j, 0, vsrc)); dst[cpos(i, j, 0, vdst)] = (val == ignore ? 0 : 1); } for (j = 1; j < dy - 1; j++) { // first column i = 0; val = extract_int(vsrc, cpos(i, j, 0, vsrc)); dst[cpos(i, j, 0, vdst)] = (val == ignore ? 0 : 1); // middle columns for (i = 1; i < dx - 1; i++) { val = extract_int(vsrc, cpos(i, j, 0, vsrc)); dst[cpos(i, j, 0, vdst)] = (val == ignore ? 0 : 1 + min(dst[cpos(i - 1, j, 0, vdst)], dst[cpos(i, j - 1, 0, vdst)])); } // last column val = extract_int(vsrc, cpos(i, j, 0, vsrc)); dst[cpos(i, j, 0, vdst)] = (val == ignore ? 0 : 1); } // last row for (i = 0; i < dx; i++) { val = extract_int(vsrc, cpos(i, j, 0, vsrc)); dst[cpos(i, j, 0, vdst)] = (val == ignore ? 0 : 1); } // Now the other direction for (j = dy - 2; j >= 0; --j) { for (i = dx - 2; i >= 0; --i) { if (dst[cpos(i, j, 0, vdst)] != 0) { int m = min(dst[cpos(i + 1, j, 0, vdst)], dst[cpos(i, j + 1, 0, vdst)]); if (m < dst[cpos(i, j, 0, vdst)]) dst[cpos(i, j, 0, vdst)] = m + 1; } } } return (vdst); }
/* * validate a user */ void cmd_vali(char *v_args) { char user[128]; int newax; struct ctdluser userbuf; extract_token(user, v_args, 0, '|', sizeof user); newax = extract_int(v_args, 1); if (CtdlAccessCheck(ac_aide) || (newax > AxAideU) || (newax < AxDeleted)) { return; } if (CtdlGetUserLock(&userbuf, user) != 0) { cprintf("%d '%s' not found.\n", ERROR + NO_SUCH_USER, user); return; } userbuf.axlevel = newax; userbuf.flags = (userbuf.flags & ~US_NEEDVALID); CtdlPutUserLock(&userbuf); /* If the access level was set to zero, delete the user */ if (newax == 0) { if (purge_user(user) == 0) { cprintf("%d %s Deleted.\n", CIT_OK, userbuf.fullname); return; } } cprintf("%d User '%s' validated.\n", CIT_OK, userbuf.fullname); }
void write_l (st_parameter_dt *dtp, const fnode *f, char *source, int len) { char *p; int wlen; GFC_INTEGER_LARGEST n; wlen = (f->format == FMT_G && f->u.w == 0) ? 1 : f->u.w; p = write_block (dtp, wlen); if (p == NULL) return; n = extract_int (source, len); if (unlikely (is_char4_unit (dtp))) { gfc_char4_t *p4 = (gfc_char4_t *) p; memset4 (p4, ' ', wlen -1); p4[wlen - 1] = (n) ? 'T' : 'F'; return; } memset (p, ' ', wlen -1); p[wlen - 1] = (n) ? 'T' : 'F'; }
void draw_box(Var* obj, int x, int y, float ignore, char* out) { int i, j, k; int v; for (j = 0; j < y; j++) { for (i = 0; i < x; i++) { v = extract_int(obj, cpos(i, j, 0, obj)); if (v != ignore && v > 0) { for (k = -v; k <= v; k++) { if (i + k >= 0 && i + k < x) { if (j - v >= 0 && j - v < y) { out[cpos(i + k, j - v, 0, obj)] = 1; } if (j + v >= 0 && j + v < y) { out[cpos(i + k, j + v, 0, obj)] = 1; } } if (j + k >= 0 && j + k < y) { if (i - v >= 0 && i - v < x) { out[cpos(i - v, j + k, 0, obj)] = 1; } if (i + v >= 0 && i + v < x) { out[cpos(i + v, j + k, 0, obj)] = 1; } } } } } } }
/* * Shut down the server */ void cmd_down(char *argbuf) { char *Reply ="%d Shutting down server. Goodbye.\n"; if (CtdlAccessCheck(ac_aide)) return; if (!IsEmptyStr(argbuf)) { int state = CIT_OK; restart_server = extract_int(argbuf, 0); if (restart_server > 0) { Reply = "%d citserver will now shut down and automatically restart.\n"; } if ((restart_server > 0) && !running_as_daemon) { syslog(LOG_ERR, "The user requested restart, but not running as daemon! Geronimooooooo!\n"); Reply = "%d Warning: citserver is not running in daemon mode and is therefore unlikely to restart automatically.\n"; state = ERROR; } cprintf(Reply, state); } else { cprintf(Reply, CIT_OK + SERVER_SHUTTING_DOWN); } CC->kill_me = KILLME_SERVER_SHUTTING_DOWN; server_shutting_down = 1; }
void cmd_log_set(char *argbuf) { void *vptr; int lset; int wlen; char which[SIZ] = ""; if (CtdlAccessCheck(ac_aide)) return; wlen = extract_token(which, argbuf, 0, '|', sizeof(which)); if (wlen < 0) wlen = 0; lset = extract_int(argbuf, 1); if (lset != 0) lset = 1; if (GetHash(LogDebugEntryTable, which, wlen, &vptr) && (vptr != NULL)) { LogDebugEntry *E = (LogDebugEntry*)vptr; E->F(lset); cprintf("%d %s|%d\n", CIT_OK, which, lset); } else { cprintf("%d Log setting %s not known\n", ERROR, which); } }
/* * edit a floor */ void cmd_eflr(char *argbuf) { struct floor flbuf; int floor_num; int np; np = num_parms(argbuf); if (np < 1) { cprintf("%d Usage error.\n", ERROR + ILLEGAL_VALUE); return; } if (CtdlAccessCheck(ac_aide)) return; floor_num = extract_int(argbuf, 0); lgetfloor(&flbuf, floor_num); if ((flbuf.f_flags & F_INUSE) == 0) { lputfloor(&flbuf, floor_num); cprintf("%d Floor %d is not in use.\n", ERROR + INVALID_FLOOR_OPERATION, floor_num); return; } if (np >= 2) extract_token(flbuf.f_name, argbuf, 1, '|', sizeof flbuf.f_name); lputfloor(&flbuf, floor_num); cprintf("%d Ok\n", CIT_OK); }
/* * Poll room for incoming chat messages */ void roomchat_poll(char *argbuf) { int newer_than = 0; struct chatmsg *found = NULL; struct chatmsg *ptr = NULL; newer_than = extract_int(argbuf, 1); if ((CC->cs_flags & CS_CHAT) == 0) { cprintf("%d Session is not in chat mode.\n", ERROR); return; } begin_critical_section(S_CHATQUEUE); for (ptr = first_chat_msg; ((ptr != NULL) && (found == NULL)); ptr = ptr->next) { if ((ptr->seq > newer_than) && (ptr->roomnum == CC->room.QRnumber)) { found = ptr; } } end_critical_section(S_CHATQUEUE); if (found == NULL) { cprintf("%d no messages\n", ERROR + MESSAGE_NOT_FOUND); return; } cprintf("%d %d|%ld|%s\n", LISTING_FOLLOWS, found->seq, found->timestamp, found->sender); cprintf("%s\n", found->msgtext); cprintf("000\n"); }
/* * Request client termination */ void cmd_reqt(char *argbuf) { struct CitContext *ccptr; int sessions = 0; int which_session; struct ExpressMessage *newmsg; if (CtdlAccessCheck(ac_aide)) return; which_session = extract_int(argbuf, 0); begin_critical_section(S_SESSION_TABLE); for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) { if ((ccptr->cs_pid == which_session) || (which_session == 0)) { newmsg = (struct ExpressMessage *) malloc(sizeof (struct ExpressMessage)); memset(newmsg, 0, sizeof (struct ExpressMessage)); time(&(newmsg->timestamp)); safestrncpy(newmsg->sender, CC->user.fullname, sizeof newmsg->sender); newmsg->flags |= EM_GO_AWAY; newmsg->text = strdup("Automatic logoff requested."); add_xmsg_to_context(ccptr, newmsg); ++sessions; } } end_critical_section(S_SESSION_TABLE); cprintf("%d Sent termination request to %d sessions.\n", CIT_OK, sessions); }
void do_graphics_upload(char *filename) { StrBuf *Line; const char *MimeType; wcsession *WCC = WC; int bytes_remaining; int pos = 0; int thisblock; bytes_remaining = WCC->upload_length; if (havebstr("cancel_button")) { AppendImportantMessage(_("Graphics upload has been cancelled."), -1); display_main_menu(); return; } if (WCC->upload_length == 0) { AppendImportantMessage(_("You didn't upload a file."), -1); display_main_menu(); return; } MimeType = GuessMimeType(ChrPtr(WCC->upload), bytes_remaining); serv_printf("UIMG 1|%s|%s", MimeType, filename); Line = NewStrBuf(); StrBuf_ServGetln(Line); if (GetServerStatusMsg(Line, NULL, 1, 2) != 2) { display_main_menu(); FreeStrBuf(&Line); return; } while (bytes_remaining) { thisblock = ((bytes_remaining > 4096) ? 4096 : bytes_remaining); serv_printf("WRIT %d", thisblock); StrBuf_ServGetln(Line); if (GetServerStatusMsg(Line, NULL, 1, 7) != 7) { serv_puts("UCLS 0"); StrBuf_ServGetln(Line); display_main_menu(); FreeStrBuf(&Line); return; } thisblock = extract_int(ChrPtr(Line) +4, 0); serv_write(&ChrPtr(WCC->upload)[pos], thisblock); pos += thisblock; bytes_remaining -= thisblock; } serv_puts("UCLS 1"); StrBuf_ServGetln(Line); if (*ChrPtr(Line) != 'x') { display_success(ChrPtr(Line) + 4); } FreeStrBuf(&Line); }
void cmd_lprm(char *argbuf) { int FloorBeingSearched = (-1); if (!IsEmptyStr(argbuf)) FloorBeingSearched = extract_int(argbuf, 0); cprintf("%d Public rooms:\n", LISTING_FOLLOWS); CtdlForEachRoom(cmd_lprm_backend, &FloorBeingSearched); cprintf("000\n"); }
/* * create a new floor */ void cmd_cflr(char *argbuf) { char new_floor_name[256]; struct floor flbuf; int cflr_ok; int free_slot = (-1); int a; extract_token(new_floor_name, argbuf, 0, '|', sizeof new_floor_name); cflr_ok = extract_int(argbuf, 1); if (CtdlAccessCheck(ac_aide)) return; if (IsEmptyStr(new_floor_name)) { cprintf("%d Blank floor name not allowed.\n", ERROR + ILLEGAL_VALUE); return; } for (a = 0; a < MAXFLOORS; ++a) { CtdlGetFloor(&flbuf, a); /* note any free slots while we're scanning... */ if (((flbuf.f_flags & F_INUSE) == 0) && (free_slot < 0)) free_slot = a; /* check to see if it already exists */ if ((!strcasecmp(flbuf.f_name, new_floor_name)) && (flbuf.f_flags & F_INUSE)) { cprintf("%d Floor '%s' already exists.\n", ERROR + ALREADY_EXISTS, flbuf.f_name); return; } } if (free_slot < 0) { cprintf("%d There is no space available for a new floor.\n", ERROR + INVALID_FLOOR_OPERATION); return; } if (cflr_ok == 0) { cprintf("%d ok to create...\n", CIT_OK); return; } lgetfloor(&flbuf, free_slot); flbuf.f_flags = F_INUSE; flbuf.f_ref_count = 0; safestrncpy(flbuf.f_name, new_floor_name, sizeof flbuf.f_name); lputfloor(&flbuf, free_slot); cprintf("%d %d\n", CIT_OK, free_slot); }
/* * delete a floor */ void cmd_kflr(char *argbuf) { struct floor flbuf; int floor_to_delete; int kflr_ok; int delete_ok; floor_to_delete = extract_int(argbuf, 0); kflr_ok = extract_int(argbuf, 1); if (CtdlAccessCheck(ac_aide)) return; lgetfloor(&flbuf, floor_to_delete); delete_ok = 1; if ((flbuf.f_flags & F_INUSE) == 0) { cprintf("%d Floor %d not in use.\n", ERROR + INVALID_FLOOR_OPERATION, floor_to_delete); delete_ok = 0; } else { if (flbuf.f_ref_count != 0) { cprintf("%d Cannot delete; floor contains %d rooms.\n", ERROR + INVALID_FLOOR_OPERATION, flbuf.f_ref_count); delete_ok = 0; } else { if (kflr_ok == 1) { cprintf("%d Ok\n", CIT_OK); } else { cprintf("%d Ok to delete...\n", CIT_OK); } } } if ((delete_ok == 1) && (kflr_ok == 1)) flbuf.f_flags = 0; lputfloor(&flbuf, floor_to_delete); }
static void add_type_mapping (struct TypeMappingInfo **info, const char *source_apk, const char *source_entry, const char *addr) { struct TypeMappingInfo *p = calloc (1, sizeof (struct TypeMappingInfo)); int version = 0; const char *data = addr; if (!p) return; extract_int (&data, source_apk, source_entry, "version", &version); if (version != 1) { log_warn (LOG_DEFAULT, "Unsupported version '%i' within type mapping file '%s!%s'. Ignoring...", version, source_apk, source_entry); return; } extract_int (&data, source_apk, source_entry, "entry-count", &p->num_entries); extract_int (&data, source_apk, source_entry, "entry-len", &p->entry_length); extract_int (&data, source_apk, source_entry, "value-offset", &p->value_offset); p->mapping = data; if ((p->mapping == 0) || (p->num_entries <= 0) || (p->entry_length <= 0) || (p->value_offset >= p->entry_length) || (p->mapping == NULL)) { log_warn (LOG_DEFAULT, "Could not read type mapping file '%s!%s'. Ignoring...", source_apk, source_entry); free (p); return; } p->source_apk = monodroid_strdup_printf ("%s", source_apk); p->source_entry = monodroid_strdup_printf ("%s", source_entry); if (*info) { (*info)->next = p; } else { *info = p; } }
static void write_integer (st_parameter_dt *dtp, const char *source, int length) { char *p; const char *q; int digits; int width; char itoa_buf[GFC_ITOA_BUF_SIZE]; q = gfc_itoa (extract_int (source, length), itoa_buf, sizeof (itoa_buf)); switch (length) { case 1: width = 4; break; case 2: width = 6; break; case 4: width = 11; break; case 8: width = 20; break; default: width = 0; break; } digits = strlen (q); if (width < digits) width = digits; p = write_block (dtp, width); if (p == NULL) return; if (dtp->u.p.no_leading_blank) { memcpy (p, q, digits); memset (p + digits, ' ', width - digits); } else { memset (p, ' ', width - digits); memcpy (p + width - digits, q, digits); } }
/* * Enter or exit paging-disabled mode */ void cmd_dexp(char *argbuf) { int new_state; if (CtdlAccessCheck(ac_logged_in)) return; new_state = extract_int(argbuf, 0); if ((new_state == 0) || (new_state == 1)) { CC->disable_exp = new_state; } cprintf("%d %d\n", CIT_OK, CC->disable_exp); }
// This marks all the pixels inside the outermost extents. Not exactly // grassfire, but closely related. Var* bounding_box(Var* vsrc, int ignore) { size_t dx = GetX(vsrc); size_t dy = GetY(vsrc); int left, right, i, j; int val; int* dst = calloc(dx * dy, sizeof(int)); if (dst == NULL) { parse_error("Unable to allocate memory."); return (NULL); } Var* vdst = newVal(BSQ, dx, dy, 1, DV_INT32, dst); for (j = 0; j < dy; j++) { for (left = 0; left < dx; left++) { val = extract_int(vsrc, cpos(left, j, 0, vsrc)); if (val == ignore) { dst[cpos(left, j, 0, vdst)] = 0; } else { break; } } for (right = dx - 1; right >= 0; right--) { val = extract_int(vsrc, cpos(right, j, 0, vsrc)); if (val == ignore) { dst[cpos(right, j, 0, vdst)] = 0; } else { break; } } for (i = left; i < right; i++) { dst[cpos(i, j, 0, vdst)] = 1; } } return (vdst); }
void write_l (st_parameter_dt *dtp, const fnode *f, char *source, int len) { char *p; GFC_INTEGER_LARGEST n; p = write_block (dtp, f->u.w); if (p == NULL) return; memset (p, ' ', f->u.w - 1); n = extract_int (source, len); p[f->u.w - 1] = (n) ? 'T' : 'F'; }
void cmd_lrms(char *argbuf) { int FloorBeingSearched = (-1); if (!IsEmptyStr(argbuf)) FloorBeingSearched = extract_int(argbuf, 0); if (CtdlAccessCheck(ac_logged_in_or_guest)) return; CtdlGetUser(&CC->user, CC->curr_user); cprintf("%d Accessible rooms:\n", LISTING_FOLLOWS); CtdlForEachRoom(cmd_lrms_backend, &FloorBeingSearched); cprintf("000\n"); }
/* * set user parameters */ void cmd_setu(char *new_parms) { if (CtdlAccessCheck(ac_logged_in)) return; if (num_parms(new_parms) < 3) { cprintf("%d Usage error.\n", ERROR + ILLEGAL_VALUE); return; } CtdlLockGetCurrentUser(); CC->user.flags = CC->user.flags & (~US_USER_SET); CC->user.flags = CC->user.flags | (extract_int(new_parms, 2) & US_USER_SET); CtdlPutCurrentUserLock(); cprintf("%d Ok\n", CIT_OK); }
/* * Set the preferred view for the current user/room combination */ void cmd_view(char *cmdbuf) { int requested_view; visit vbuf; if (CtdlAccessCheck(ac_logged_in)) { return; } requested_view = extract_int(cmdbuf, 0); CtdlGetRelationship(&vbuf, &CC->user, &CC->room); vbuf.v_view = requested_view; CtdlSetRelationship(&vbuf, &CC->user, &CC->room); cprintf("%d ok\n", CIT_OK); }
void write_l (st_parameter_dt *dtp, const fnode *f, char *source, int len) { char *p; int wlen; GFC_INTEGER_LARGEST n; wlen = (f->format == FMT_G && f->u.w == 0) ? 1 : f->u.w; p = write_block (dtp, wlen); if (p == NULL) return; memset (p, ' ', wlen - 1); n = extract_int (source, len); p[wlen - 1] = (n) ? 'T' : 'F'; }
void draw_circle(Var* obj, int x, int y, float ignore, char* out) { int i, j; int r; double f, ir; double c, s; int ic, js; for (j = 0; j < y; j++) { for (i = 0; i < x; i++) { r = extract_int(obj, cpos(i, j, 0, obj)); if (r != ignore && r > 0) { ir = 1.0 / r; for (f = 0; f < M_PI_2; f += ir / 2) { c = rint(cos(f) * r); s = rint(sin(f) * r); ic = i + c; js = j + s; if (ic >= 0 && ic < x && js >= 0 && js < y) { out[cpos(ic, js, 0, obj)] = 1; } ic = i - c; js = j - s; if (ic >= 0 && ic < x && js >= 0 && js < y) { out[cpos(ic, js, 0, obj)] = 1; } ic = i + c; js = j - s; if (ic >= 0 && ic < x && js >= 0 && js < y) { out[cpos(ic, js, 0, obj)] = 1; } ic = i - c; js = j + s; if (ic >= 0 && ic < x && js >= 0 && js < y) { out[cpos(ic, js, 0, obj)] = 1; } } } } } }
/* * enter or exit "stealth mode" */ void cmd_stel(char *cmdbuf) { int requested_mode; requested_mode = extract_int(cmdbuf,0); if (CtdlAccessCheck(ac_logged_in)) return; if (requested_mode == 1) { CC->cs_flags = CC->cs_flags | CS_STEALTH; PerformSessionHooks(EVT_STEALTH); } if (requested_mode == 0) { CC->cs_flags = CC->cs_flags & ~CS_STEALTH; PerformSessionHooks(EVT_UNSTEALTH); } cprintf("%d %d\n", CIT_OK, ((CC->cs_flags & CS_STEALTH) ? 1 : 0) ); }
void cmd_seen(char *argbuf) { long target_msgnum = 0L; int target_setting = 0; if (CtdlAccessCheck(ac_logged_in)) { return; } if (num_parms(argbuf) != 2) { cprintf("%d Invalid parameters\n", ERROR + ILLEGAL_VALUE); return; } target_msgnum = extract_long(argbuf, 0); target_setting = extract_int(argbuf, 1); CtdlSetSeen(&target_msgnum, 1, target_setting, ctdlsetseen_seen, NULL, NULL); cprintf("%d OK\n", CIT_OK); }
/* * admin command: kill the current room */ void cmd_kill(char *argbuf) { char deleted_room_name[ROOMNAMELEN]; char msg[SIZ]; int kill_ok; kill_ok = extract_int(argbuf, 0); if (CtdlDoIHavePermissionToDeleteThisRoom(&CC->room) == 0) { cprintf("%d Can't delete this room.\n", ERROR + NOT_HERE); return; } if (kill_ok) { if (CC->room.QRflags & QR_MAILBOX) { safestrncpy(deleted_room_name, &CC->room.QRname[11], sizeof deleted_room_name); } else { safestrncpy(deleted_room_name, CC->room.QRname, sizeof deleted_room_name); } /* Do the dirty work */ CtdlScheduleRoomForDeletion(&CC->room); /* Return to the Lobby */ CtdlUserGoto(CtdlGetConfigStr("c_baseroom"), 0, 0, NULL, NULL, NULL, NULL); /* tell the world what we did */ snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n", deleted_room_name, (CC->logged_in ? CC->curr_user : "******") ); CtdlAideMessage(msg, "Room Purger Message"); cprintf("%d '%s' deleted.\n", CIT_OK, deleted_room_name); } else { cprintf("%d ok to delete.\n", CIT_OK); } }