void login_screen (player * p) { if (system_flags & LOCKOUT) { writep (p, " Sorry, but we're currently closed to all connections.\n\n"); p->flags |= P_LOGOUT; return; } if (shutdown_count > 0) { tell_player (p, " Sorry, there is a system reboot scheduled in %s. Please try again later.\n\n", word_time (shutdown_count)); p->flags |= P_LOGOUT; return; } writep (p, connect_msg.data); tell_player (p, " Serpent is running on %s Version %s on %s hardware.\n Nodename is %s.\n\n", uts.sysname, uts.release, uts.machine, uts.nodename); login_prompt (p); return; }
void set_session(player * p, char *str) { char *oldstack; time_t t; player *scan; int wait; oldstack = stack; if (p->custom_flags & YES_SESSION) { tell_player(p, " You are ignoring sessions - type \"muffle session\" to toggle.\n"); return; } t = time(0); if (session_reset) wait = session_reset - (int) t; else wait = 0; if (wait < 0) wait = 0; if (strlen(session) == 0) { strncpy(session, get_session_msg("default_session"), MAX_SESSION - 3); strncpy(sess_name, get_session_msg("default_setter"), MAX_NAME - 1); } if (!*str) { sprintf(stack, " The session is currently '%s'\n", session); stack = strchr(stack, 0); sprintf(stack, " It was set by %s, and can be reset in %s.\n", sess_name, word_time(wait)); stack = end_string(stack); tell_player(p, oldstack); stack = oldstack; return; } if (wait > 0 /* && p != p_sess */ ) { sprintf(stack, " Session can be reset in %s\n", word_time(wait)); stack = end_string(stack); tell_player(p, oldstack); stack = oldstack; return; } if (config_flags & cfNOSWEAR) str = filter_rude_words(str); if (strlen(str) > 55) { tell_player(p, " Too long a session name ...\n"); stack = oldstack; return; } if (strstr(str, "^")) { tell_player(p, " Sorry, but you can't have colours in a session title.\n"); return; } if (strstr(str, "&")) { tell_player(p, " Sorry, but you can't have dynatext in a session title.\n"); return; } sprintf(session, "%s", str); sprintf(stack, " You reset the session message to be '%s^N'\n", str); stack = end_string(stack); tell_player(p, oldstack); /* reset comments */ for (scan = flatlist_start; scan; scan = scan->flat_next) strncpy(scan->comment, "", MAX_COMMENT - 3); stack = oldstack; sprintf(stack, "%s sets the session to be '%s'\n", p->name, str); stack = end_string(stack); command_type |= EVERYONE; for (scan = flatlist_start; scan; scan = scan->flat_next) if (scan != p && !(scan->custom_flags & YES_SESSION)) tell_player(scan, oldstack); stack = oldstack; if (strcmp(sess_name, p->name) || wait <= 0) session_reset = t + (60 * atoi(get_session_msg("session_reset_time"))); p_sess = p; strcpy(sess_name, p->name); sprintf(stack, "%s- %s", p->name, session); stack = end_string(stack); log("session", oldstack); stack = oldstack; }
void set_session(player * p, char *str) { char *oldstack; time_t t; player *scan; int wait, yessu = 0; oldstack = stack; t = time(0); if (session_reset) wait = session_reset - (int) t; else wait = 0; if (wait < 0) wait = 0; if (strlen(session) == 0) { strncpy(session, "not set", MAX_SESSION - 2); strcpy(sess_name, "No-One"); } if (!*str) { sprintf(stack, " The session is currently '%s'\n", session); stack = strchr(stack, 0); sprintf(stack, " It was set by %s, and can be reset in %s.\n", sess_name, word_time(wait)); stack = end_string(stack); tell_player(p, oldstack); stack = oldstack; return; } if (wait > 0 && p != p_sess) { sprintf(stack, " Session can be reset in %s\n", word_time(wait)); stack = end_string(stack); tell_player(p, oldstack); stack = oldstack; return; } if (strlen(str) > 55) { tell_player(p, " Too long a session name ...\n"); stack = oldstack; return; } strcpy(session, str); sprintf(stack, " You reset the session message to be '%s'\n", str); stack = end_string(stack); tell_player(p, oldstack); /* reset comments */ for (scan = flatlist_start; scan; scan = scan->flat_next) strncpy(scan->comment, "", MAX_COMMENT - 2); stack = oldstack; sprintf(stack, "%s set%s the session to be '%s'\n", p->name, single_s(p), str); stack = end_string(stack); command_type |= EVERYONE; for (scan = flatlist_start; scan; scan = scan->flat_next) if (scan != p && !(scan->saved_flags & YES_SESSION)) tell_player(scan, oldstack); stack = oldstack; if (strcmp(sess_name, p->name) || wait <= 0) session_reset = t + (60 * 15); p_sess = p; strcpy(sess_name, p->name); sprintf(stack, "%s- %s", p->name, session); stack = end_string(stack); log("session", oldstack); stack = oldstack; }
void show_spodlist(UR_OBJECT user) { int start_pos = 1, end_pos, listed, pos = 0, hilight = 0; SP_OBJECT sp; calc_spodlist(); sp = first_spod; listed = people_in_spodlist(); if (*word[1]) { /* We will assume it is a position they want. If it is a name then we can easily overwrite it */ hilight = atoi(word[1]); if (!hilight) { if (!find_user_listed(word[1])) { write_user(user, nosuchuser); return; } else { hilight = find_spodlist_position(word[1]); } } if (hilight > listed) { start_pos = listed - 16; hilight = 0; } else { start_pos = hilight - 8; if (start_pos < 1) { start_pos = 1; } } } else { /* I personally like it defaulting to a user name */ hilight = find_spodlist_position(user->name); start_pos = hilight - 8; if (start_pos < 1) { start_pos = 1; } } end_pos = start_pos + 16; if (end_pos > listed) { end_pos = listed; start_pos = end_pos - 16; } /* Create the page */ write_user(user, "+----------------------------------------------------------------------------+\n"); write_user(user, "| ~FC~OLSpod List~RS |\n"); write_user(user, "+----------------------------------------------------------------------------+\n"); for (pos = 1; pos <= end_pos && sp; ++pos, sp = sp->next) { if (pos >= start_pos) { vwrite_user(user, "| %s%4d. %-20s %45s~RS |\n", (pos == hilight ? "~OL~FG" : ""), pos, sp->name, word_time(sp->login)); } } if (start_pos < 1) { start_pos = 1; } write_user(user, "+----------------------------------------------------------------------------+\n"); write_user(user, align_string(0, 78, 1, "|", " Positions %d to %d (out of %d users) ", start_pos, end_pos, listed)); write_user(user, "+----------------------------------------------------------------------------+\n"); }