Beispiel #1
0
/*
 * well...Duh! Reload the gun
 */
void
reload_gun(UR_OBJECT user)
{
  RM_OBJECT rm;

  rm = get_room_full(amsys->default_shoot);
  if (!rm) {
    write_user(user, "There is nowhere that you can shoot.\n");
    return;
  }
  if (user->room != rm) {
    vwrite_user(user,
                "Do not be shooting in a public place. Go to the ~OL%s~RS to play.\n",
                rm->name);
    return;
  }
  if (user->bullets > 0) {
    vwrite_user(user, "You have ~OL%d~RS bullets left.\n", user->bullets);
    return;
  }
  vwrite_room_except(user->room, user, "~FY%s reloads their gun.\n",
                     user->bw_recap);
  write_user(user, "~FYYou reload your gun.\n");
  user->bullets = 6;
}
Beispiel #2
0
/*
 * allows a user to rename their room
 */
void
personal_room_rename(UR_OBJECT user, char *inpstr)
{
  if (!amsys->personal_rooms) {
    write_user(user, "Personal room functions are currently disabled.\n");
    return;
  }
  if (word_count < 2) {
    write_user(user, "Usage: myname <name you want room to have>\n");
    return;
  }
  if (strcmp(user->room->owner, user->name)) {
    write_user(user, "You have to be in your personal room to rename it.\n");
    return;
  }
  if (strlen(inpstr) > PERSONAL_ROOMNAME_LEN) {
    write_user(user, "You cannot have a room name that long.\n");
    return;
  }
  if (strlen(inpstr) - teslen(inpstr, 0) < 1) {
    write_user(user, "You must enter a room name.\n");
    return;
  }
  strcpy(user->room->show_name, inpstr);
  vwrite_user(user, "You have now renamed your room to: %s\n",
              user->room->show_name);
  if (!personal_room_store(user->name, 1, user->room)) {
    write_syslog(SYSLOG | ERRLOG, 1,
                 "ERROR: Unable to save personal room status in personal_room_rename()\n");
  }
}
Beispiel #3
0
/*
 * clears a room topic
 */
void
clear_topic(UR_OBJECT user)
{
  RM_OBJECT rm;
  const char *name;

  if (word_count < 2) {
    rm = user->room;
    *rm->topic = '\0';
    write_user(user, "Topic has been cleared\n");
    name = user->vis ? user->recap : invisname;
    vwrite_room_except(rm, user, "%s~RS ~FY~OLhas cleared the topic.\n",
                       name);
    return;
  }
  strtolower(word[1]);
  if (!strcmp(word[1], "all")) {
    if (user->level > (enum lvl_value) command_table[CTOPIC].level
        || user->level >= ARCH) {
      for (rm = room_first; rm; rm = rm->next) {
        *rm->topic = '\0';
        write_room_except(rm, "\n~FY~OLThe topic has been cleared.\n", user);
      }
      write_user(user, "All room topics have now been cleared\n");
      return;
    }
    write_user(user,
               "You can only clear the topic of the room you are in.\n");
    return;
  }
  write_user(user, "Usage: ctopic [all]\n");
}
Beispiel #4
0
/*
 * Enter a description for a personal room
 */
void
personal_room_decorate(UR_OBJECT user, char *inpstr)
{
  if (inpstr) {
    if (!amsys->personal_rooms) {
      write_user(user, "Personal room functions are currently disabled.\n");
      return;
    }
    if (strcmp(user->room->owner, user->name)) {
      write_user(user,
                 "You have to be in your personal room to decorate it.\n");
      return;
    }
    if (word_count < 2) {
      write_user(user, "\n~BB*** Decorating your personal room ***\n\n");
      user->misc_op = 19;
      editor(user, NULL);
      return;
    }
    strcat(inpstr, "\n");
  } else {
    inpstr = user->malloc_start;
  }
  *user->room->desc = '\0';
  strncat(user->room->desc, inpstr, ROOM_DESC_LEN);
  if (strlen(user->room->desc) < strlen(inpstr)) {
    vwrite_user(user, "The description is too long for the room \"%s\".\n",
                user->room->name);
  }
  write_user(user, "You have now redecorated your personal room.\n");
  if (!personal_room_store(user->name, 1, user->room)) {
    write_syslog(SYSLOG | ERRLOG, 1,
                 "ERROR: Unable to save personal room status in personal_room_decorate()\n");
  }
}
Beispiel #5
0
/*** Show list of people suggestions are from without seeing the whole lot ***/
void suggestions_from(UR_OBJECT user)
{
    FILE *fp;
    int cnt;
    char id[ARR_SIZE],line[ARR_SIZE], *str;

    set_crash();
    if (!amsys->suggestion_count) {
        write_user(user,"There are currently no suggestions.\n");
        return;
    }
    if (!(fp=fopen(SUGBOARD, "r"))) {
        write_user(user,"There was an error trying to read the suggestion board.\n");
        write_syslog(ERRLOG,1,"Unable to open suggestion board in suggestions_from().\n");
        return;
    }
    write_user(user,"\n~BB*** Suggestions on the suggestions board from ***\n\n");
    cnt=0;
    line[0]='\0';
    fgets(line,ARR_SIZE-1,fp);
    while (!feof(fp)) {
        sscanf(line,"%s",id);
        str=colour_com_strip(id);
        if (!strcmp(str,"From:")) {
            cnt++;
            vwrite_user(user,"~FT%2d)~RS %s",cnt,remove_first(line));
        }
        line[0]='\0';
        fgets(line,ARR_SIZE-1,fp);
    }
    fclose(fp);
    vwrite_user(user,"\nTotal of ~OL%d~RS suggestions.\n\n",amsys->suggestion_count);
}
Beispiel #6
0
/*
 * no longer invite a user to the room you are in if you invited them
 */
void
uninvite(UR_OBJECT user)
{
  UR_OBJECT u;
  const char *name;

  if (word_count < 2) {
    write_user(user, "Uninvite who?\n");
    return;
  }
  u = get_user_name(user, word[1]);
  if (!u) {
    write_user(user, notloggedon);
    return;
  }
  if (u == user) {
    write_user(user, "You cannot uninvite yourself.\n");
    return;
  }
  if (!u->invite_room) {
    vwrite_user(user, "%s~RS has not been invited anywhere.\n", u->recap);
    return;
  }
  if (strcmp(u->invite_by, user->name)) {
    vwrite_user(user, "%s~RS has not been invited anywhere by you!\n",
                u->recap);
    return;
  }
  vwrite_user(user, "You cancel your invitation to %s~RS.\n", u->recap);
  name = user->vis || u->level >= user->level ? user->recap : invisname;
  vwrite_user(u, "%s~RS cancels your invitation.\n", name);
  u->invite_room = NULL;
  *u->invite_by = '\0';
}
Beispiel #7
0
Datei: adds.c Projekt: Lopo/Lotos
void write_room_except2(RM_OBJECT rm, char *str, UR_OBJECT user, UR_OBJECT user2)
{
	UR_OBJECT u;

	set_crash();
for (u=user_first; u!=NULL; u=u->next) {
  if (u->login 
      || u->room==NULL 
      || (u->room!=rm && rm!=NULL) 
      || (u->ignore.all && !force_listen)
      || (u->ignore.shouts && (com_num==SHOUT || com_num==SEMOTE || com_num==SHOUTTO))
      || (u->ignore.logons && logon_flag)
      || (u->ignore.greets && com_num==GREET)
      || u==user
      || u==user2) continue;
  if ((check_igusers(u,user))!=-1 && user->level<ARCH) continue;
  if (u->type==CLONE_TYPE) {
    if (u->clone_hear==CLONE_HEAR_NOTHING || u->owner->ignore.all) continue;
    /* Ignore anything not in clones room, eg shouts, system messages
       and semotes since the clones owner will hear them anyway. */
    if (rm!=u->room) continue;
    if (u->clone_hear==CLONE_HEAR_SWEARS) {
      if (!contains_swearing(str)) continue;
      }
    sprintf(text, "~FT[ %s ]:~RS %s",u->room->name,str);
    write_user(u->owner, text);
    }
  else write_user(u,str);
  } /* end for */
}
Beispiel #8
0
/*
 * Set user visible or invisible
 */
void
visibility(UR_OBJECT user, int vis)
{
    if (vis) {
        if (user->vis) {
            write_user(user, "You are already visible.\n");
            return;
        }
        write_user(user,
                "~FB~OLYou recite a melodic incantation and reappear.\n");
        vwrite_room_except(user->room, user,
                "~FB~OLYou hear a melodic incantation chanted and %s materialises!\n",
                user->bw_recap);
        user->vis = 1;
        return;
    }
    if (!user->vis) {
        write_user(user, "You are already invisible.\n");
        return;
    }
    write_user(user, "~FB~OLYou recite a melodic incantation and fade out.\n");
    vwrite_room_except(user->room, user,
            "~FB~OL%s recites a melodic incantation and disappears!\n",
            user->bw_recap);
    user->vis = 0;
}
Beispiel #9
0
Datei: adds.c Projekt: Lopo/Lotos
/*** Load swear words list from file ***/
void load_swear_file(UR_OBJECT user)
{
	FILE *fp;
	char line[WORD_LEN+1];
	int i;

	set_crash();
	for (i=0; i<MAX_SWEARS; i++)
		swear_words[i][0]='\0';
	i=0;
	if (user==NULL) printf("Loading swear words file ... ");
	else write_user(user,">>>Loading swear words file ... ");
	if (!(fp=fopen(SWEARFILE, "r"))) {
		strcpy(swear_words[0],"*");
		if (user==NULL) printf(" not found.\n");
		else write_user(user," not found.\n");
		return;
		}
	fgets(line,WORD_LEN+2,fp);
	while (!feof(fp)) {
		line[strlen(line)-1]='\0';
		strcpy(swear_words[i],line);
		i++;
		if (i>=MAX_SWEARS) break;
		fgets(line,WORD_LEN+2,fp);
		}
	fclose(fp);
	strcpy(swear_words[i],"*");
	if (user==NULL) printf(" done (%d words).\n",i);
	else vwrite_user(user," done ( ~FT%d~RS words ).\n",i);
}
Beispiel #10
0
Datei: adds.c Projekt: Lopo/Lotos
/* Restore a user to his original rank from a temp promote.  S.C.  09/27/99 */
void restore(UR_OBJECT user)
{
UR_OBJECT u;

	set_crash();
if (word_count<2) {
   write_usage(user,"restore <user>");
   return;
   }
if (!(u=get_user_name(user,word[1]))) {
   write_user(user, notloggedon);
   return;
   }
if (u->level>u->real_level) {
  u->level=u->real_level;
  vwrite_user(user,"%s Ma odteraz svoj originalny level.\n", u->name);
  vwrite_room_except(u->room,u,"%s begins fading as their power is restored to normal.\n",u->name);
  vwrite_user(u,"Bol obnoveny tvoj originalny level.\n");
  write_syslog(SYSLOG, 1, "%s restored %s to their original level.\n",user->name,u->name);
  sprintf(text,"Had their level restored by %s.\n",user->name);
  add_history(u->name,1,text);
  return;
  }
else {
  write_user(user,"You can't restore a person to their original rank if they're already there.\n");
  return;
  }
}
Beispiel #11
0
void check_lynx(void)
{
	UR_OBJECT user=user_first, next;
	pid_t pid;
	char fname[FNAME_LEN];

	set_crash();
	while (user) {
		next=user->next;
		if (user->lynx) {
			sprintf(fname, "%s/%s.lynx", TEMPFILES, user->name);
			pid=waitpid(user->lynx, (int *) NULL, WNOHANG);
			if (pid==user->lynx) {
				user->lynx=0;
				write_user(user, "~CTpozadovana www stranka:\n");
				switch (more(user, user->socket, fname)) {
					case 0: write_user(user, "nemozem najst nacitanu stranku"); break;
					case 1: user->misc_op=2; break;
					}
				}
			else if (pid==-1) {
				write_user(user, "chyba pri nacitavani dokumentu\n");
				}
			}
		user=next;
		}
}
Beispiel #12
0
Datei: adds.c Projekt: Lopo/Lotos
/* allows a user to rename their room */
void personal_room_rename(UR_OBJECT user,char *inpstr) {
	char name[ROOM_NAME_LEN+1];
	RM_OBJECT rm;

	if (!amsys->personal_rooms) {
		write_user(user,"Personal room functions are currently disabled.\n");
		return;
		}
	if (word_count<2) {
		write_usage(user, "%s <nazov>\n", command_table[MYNAME].name);
		return;
		}
	sprintf(name,"(%s)",user->name);
	strtolower(name);
	/* get room that user is in */
	if ((rm=get_room_full(name))==NULL) {
		write_user(user,"Sorry, but you cannot use the room renaming feature at this time.\n");
		return;
		}
	if (user->room!=rm) {
		write_user(user,"You have to be in your personal room to rename it.\n");
		return;
		}
	if (strlen(inpstr)>PERSONAL_ROOMNAME_LEN) {
		write_user(user,"You cannot have a room name that long.\n");
		return;
		}
	strcpy(rm->real_name,inpstr);
	vwrite_user(user,"You have now renamed your room to: %s\n",rm->real_name);
	if (!personal_room_store(user->name,1,rm))
		write_syslog(SYSLOG,1,"ERROR: Unable to save personal room status in personal_room_rename()\n");
}
Beispiel #13
0
/*
 * Move to another room
 */
void
go(UR_OBJECT user)
{
  RM_OBJECT rm;
  int i;

  if (user->lroom == 2) {
    write_user(user, "You have been shackled and cannot move.\n");
    return;
  }
  if (word_count < 2) {
    rm = get_room_full(amsys->default_warp);
    if (!rm) {
      write_user(user, "You cannot warp to the main room at this time.\n");
      return;
    }
    if (user->room == rm) {
      vwrite_user(user, "You are already in the %s!\n", rm->name);
      return;
    }
    move_user(user, rm, 1);
    return;
  }
#ifdef NETLINKS
  release_nl(user);
  if (transfer_nl(user)) {
    return;
  }
#endif
  rm = get_room(word[1]);
  if (!rm) {
    write_user(user, nosuchroom);
    return;
  }
  if (rm == user->room) {
    vwrite_user(user, "You are already in the %s!\n", rm->name);
    return;
  }
  /* See if link from current room */
  for (i = 0; i < MAX_LINKS; ++i) {
    if (user->room->link[i] == rm) {
      break;
    }
  }
  if (i < MAX_LINKS) {
    move_user(user, rm, 0);
    return;
  }
  if (is_personal_room(rm)) {
    write_user(user,
               "To go to another user's home you must \".visit\" them.\n");
    return;
  }
  if (user->level < WIZ) {
    vwrite_user(user, "The %s is not adjoined to here.\n", rm->name);
    return;
  }
  move_user(user, rm, 1);
}
Beispiel #14
0
/*
 * Unmuzzle the bastard now he has apologised and grovelled enough via email
 */
void
unmuzzle(UR_OBJECT user)
{
    UR_OBJECT u;
    int on;

    if (word_count < 2) {
        write_user(user, "Usage: unmuzzle <user>\n");
        return;
    }
    u = retrieve_user(user, word[1]);
    if (!u) {
        return;
    }
    on = retrieve_user_type == 1;
    /* error checks */
    if (u == user) {
        write_user(user,
                "Trying to unmuzzle yourself is the tenth sign of madness.\n");
        done_retrieve(u);
        return;
    }
    /* FIXME: Use sentinel other JAILED */
    if (u->muzzled == JAILED) {
        vwrite_user(user, "%s~RS is not muzzled.\n", u->recap);
        done_retrieve(u);
        return;
    }
    if (u->muzzled > user->level) {
        vwrite_user(user,
                "%s~RS's muzzle is set to level %s, you do not have the power to remove it.\n",
                u->recap, user_level[u->muzzled].name);
        done_retrieve(u);
        return;
    }
    /* do the unmuzzle */
    u->muzzled = JAILED; /* FIXME: Use sentinel other JAILED */
    vwrite_user(user, "~FG~OLYou remove %s~RS's muzzle.\n", u->recap);
    write_syslog(SYSLOG, 1, "%s unmuzzled %s.\n", user->name, u->name);
    add_history(u->name, 0, "~FGUnmuzzled~RS by %s, level %d (%s).\n",
            user->name, user->level, user_level[user->level].name);
    sprintf(text, "~FG~OLYou have been unmuzzled!\n");
    if (!on) {
        send_mail(user, u->name, text, 0);
    } else {
        write_user(u, text);
    }
    /* finish up */
    if (!on) {
        strcpy(u->site, u->last_site);
        u->socket = -2;
    }
    save_user_details(u, on);
    done_retrieve(u);
}
Beispiel #15
0
void send_icqpage(UR_OBJECT user, char *inpstr)
{
	char fname[FNAME_LEN], icqnum[ICQ_LEN+1], subj[100], addr[100];
	int on;
	UR_OBJECT ur;
	FILE *fp;

	if (word_count<3) {
		write_usage(user, "%s <user>/<ICQ#> <text>", command_table[ICQPAGE].name);
		return;
		}
	icqnum[0]='\0';
	if (is_number(word[1])) strncpy(icqnum, word[1], ICQ_LEN);
	else {
		if (!(ur=get_user_name(user, word[1]))) {
			if (!(ur=create_user())) {
				vwrite_user(user, "%s: nemozem vytvorit docasny user objekt.\n", syserror);
				write_syslog(ERRLOG, 1, "Unable to create temp user object in send_icqpage()\n");
				return;
				}
			strcpy(ur->name, word[1]);
			if (!load_user_details(ur)) {
				write_user(user, nosuchuser);
				destruct_user(ur);
				destructed=0;
				return;
				}
			on=0;
			}
		else on=1;
		strcpy(icqnum, ur->icq);
		if (!on) {
			destruct_user(ur);
			destructed=0;
			}
		}
	if (icqnum[0]=='\0') {
		write_user(user, "sprava neposlana, chybne alebo nezistitelne ICQ cislo\n");
		return;
		}
	sprintf(fname, "%s/%s.icq", TEMPFILES, user->name);
	if (!(fp=fopen(fname, "w"))) {
		write_user(user, "nemozem vytvorit docasny subor pre spravu\n");
		write_syslog(ERRLOG, 1, "unable to open file in send_icqpage()\n");
		return;
		}
	fprintf(fp, icq_page_email);
	fprintf(fp, "%s\n", remove_first(inpstr));
	fclose(fp);
	sprintf(addr, "*****@*****.**", icqnum);
	sprintf(subj, "ICQ page from %s", user->name);
	send_email(addr, subj, fname);
	write_user(user, "sprava bola odoslana\n");
}
Beispiel #16
0
void pl02x100_show(UR_OBJECT user)
{
	set_crash();
	if (user->pl02x100->stage==-1) {
		write_user(user,"You haven't started a game of hangman yet.\n");
		return;
		}
	write_user(user,"Your current hangman game status is:\n");
	if (strlen(user->pl02x100->guess)<1) vwrite_user(user, hanged[user->pl02x100->stage], user->pl02x100->word_show, "None yet!");
	else vwrite_user(user, hanged[user->pl02x100->stage], user->pl02x100->word_show,user->pl02x100->guess);
	write_user(user,"\n");
}
Beispiel #17
0
/*
 * Called by go() and move()
 */
void
move_user(UR_OBJECT user, RM_OBJECT rm, int teleport)
{
  RM_OBJECT old_room;

  if (teleport != 2 && !has_room_access(user, rm)) {
    write_user(user, "That room is currently private, you cannot enter.\n");
    return;
  }
  /* Reset invite room if in it */
  if (user->invite_room == rm) {
    user->invite_room = NULL;
    *user->invite_by = '\0';
  }
  if (user->vis) {
    switch (teleport) {
    case 0:
      vwrite_room(rm, "%s~RS %s.\n", user->recap, user->in_phrase);
      vwrite_room_except(user->room, user, "%s~RS %s to the %s.\n",
                         user->recap, user->out_phrase, rm->name);
      break;
    case 1:
      vwrite_room(rm, "%s~RS ~FC~OLappears in an explosion of blue magic!\n",
                  user->recap);
      vwrite_room_except(user->room, user,
                         "%s~RS ~FC~OLchants a spell and vanishes into a magical blue vortex!\n",
                         user->recap);
      break;
    case 2:
      write_user(user,
                 "\n~FC~OLA giant hand grabs you and pulls you into a magical blue vortex!\n");
      vwrite_room(rm, "%s~RS ~FC~OLfalls out of a magical blue vortex!\n",
                  user->recap);
#ifdef NETLINKS
      if (!release_nl(user))
#endif
      {
        vwrite_room_except(user->room, user,
                           "~FC~OLA giant hand grabs~RS %s~RS ~FC~OLwho is pulled into a magical blue vortex!\n",
                           user->recap);
      }
      break;
    }

  } else if (user->level < GOD) {
    write_room(rm, invisenter);
    write_room_except(user->room, invisleave, user);
  }
  old_room = user->room;
  user->room = rm;
  reset_access(old_room);
  look(user);
}
Beispiel #18
0
/** Write a suggestion to the board, or read if if you can **/
void suggestions(UR_OBJECT user, int done_editing)
{
    FILE *fp;
    char *c;
    int cnt=0;

    set_crash();
    if (com_num==RSUG) {
        write_user(user,"~BB~FG*** The Suggestions board has the following ideas ***\n\n");
        switch (more(user, user->socket, SUGBOARD)) {
        case 0:
            write_user(user,"There are no suggestions.\n\n");
            break;
        case 1:
            user->misc_op=2;
        }
        return;
    }
#ifdef NETLINKS
    if (user->type==REMOTE_TYPE) {
        write_user(user,"Remote users cannot use this command, sorry!\n");
        return;
    }
#endif
    if (!done_editing) {
        write_user(user,"~BB~FG*** Writing a suggestion ***\n\n");
        user->misc_op=8;
        editor(user,NULL);
        return;
    }
    if (!(fp=fopen(SUGBOARD, "a"))) {
        vwrite_user(user,"%s: couldn't add suggestion.\n",syserror);
        write_syslog(ERRLOG,1,"Couldn't open file %s to write in suggestions().\n", SUGBOARD);
        return;
    }
    sprintf(text,"~OLFrom: %s  %s\n",user->bw_recap,long_date(0));
    fputs(text,fp);
    c=user->malloc_start;
    while (c!=user->malloc_end) {
        putc(*c++,fp);
        if (*c=='\n') cnt=0;
        else ++cnt;
        if (cnt==80) {
            putc('\n',fp);
            cnt=0;
        }
    }
    fprintf(fp,"\n");
    fclose(fp);
    write_user(user,"Suggestion written.  Thank you for your contribution.\n");
    amsys->suggestion_count++;
}
Beispiel #19
0
void pl02x100_stop(UR_OBJECT user)
{
	set_crash();
	if (user->pl02x100->stage==-1) {
		write_user(user,"nemas rozohrateho hangmana.\n");
		return;
		}
	user->pl02x100->stage=-1;
	user->pl02x100->word[0]='\0';
	user->pl02x100->word_show[0]='\0';
	user->pl02x100->guess[0]='\0';
	write_user(user,"Vzdal si hru hangman.\n");
}
Beispiel #20
0
/*
 * lets a user start, stop or check out their status of a game of hangman
 */
void
play_hangman(UR_OBJECT user)
{
  int i;

  if (word_count < 2) {
    write_user(user, "Usage: hangman start|stop|status\n");
    return;
  }
  strtolower(word[1]);
  if (!strcmp("status", word[1])) {
    if (user->hang_stage == -1) {
      write_user(user, "You have not started a game of hangman yet.\n");
      return;
    }
    write_user(user, "Your current hangman game status is:\n");
    if (strlen(user->hang_guess) < 1) {
      vwrite_user(user, hanged[user->hang_stage], user->hang_word_show,
                  "None yet!");
    } else {
      vwrite_user(user, hanged[user->hang_stage], user->hang_word_show,
                  user->hang_guess);
    }
    write_user(user, "\n");
    return;
  }
  if (!strcmp("stop", word[1])) {
    if (user->hang_stage == -1) {
      write_user(user, "You have not started a game of hangman yet.\n");
      return;
    }
    user->hang_stage = -1;
    *user->hang_word = '\0';
    *user->hang_word_show = '\0';
    *user->hang_guess = '\0';
    write_user(user, "You stop your current game of hangman.\n");
    return;
  }
  if (!strcmp("start", word[1])) {
    if (user->hang_stage != -1) {
      write_user(user, "You have already started a game of hangman.\n");
      return;
    }
    get_hang_word(user->hang_word);
    strcpy(user->hang_word_show, user->hang_word);
    for (i = 0; user->hang_word_show[i]; ++i) {
      user->hang_word_show[i] = '-';
    }
    user->hang_stage = 0;
    write_user(user, "Your current hangman game status is:\n\n");
    vwrite_user(user, hanged[user->hang_stage], user->hang_word_show,
                "None yet!");
    return;
  }
  write_user(user, "Usage: hangman start|stop|status\n");
}
Beispiel #21
0
/*** Write figlet lines to users that want them ***/
void write_broadcast_figlet(UR_OBJECT user, UR_OBJECT u, RM_OBJECT rm, char *fig_text)
{
	set_crash();
	if (u) {
		write_user(u, fig_text);
		return;
		}
	if (rm) {
		write_room(rm, fig_text);
		return;
		}
	write_room_except(NULL, fig_text, user);
	write_user(user, fig_text);
}
Beispiel #22
0
/*** Show list of people board posts are from without seeing the whole lot ***/
void board_from(UR_OBJECT user)
{
    FILE *fp;
    int cnt;
    char id[ARR_SIZE],line[ARR_SIZE],fname[FNAME_LEN],rmname[ROOM_NAME_LEN+1];
    RM_OBJECT rm;

    set_crash();
    if (word_count<2) rm=user->room;
    else {
        if ((rm=get_room(word[1]))==NULL) {
            write_user(user,nosuchroom);
            return;
        }
        if (!has_room_access(user,rm)) {
            write_user(user,"That room is currently private, you cannot read the board.\n");
            return;
        }
    }
    if (!rm->mesg_cnt) {
        write_user(user,"That room has no messages on it's board.\n");
        return;
    }
    if (rm->access==PERSONAL_LOCKED || rm->access==PERSONAL_UNLOCKED) {
        midcpy(rm->name,rmname,1,strlen(rm->name)-2);
        rmname[0]=toupper(rmname[0]);
        sprintf(fname,"%s/%s.B", USERROOMS, rmname);
    }
    else sprintf(fname,"%s/%s.B", ROOMFILES, rm->name);
    if (!(fp=fopen(fname,"r"))) {
        write_user(user,"There was an error trying to read message board.\n");
        write_syslog(ERRLOG,1,"Unable to open message board for %s in board_from().\n",rm->name);
        return;
    }
    vwrite_user(user,"\n~FG~BB*** Posts on the %s message board from ***\n\n",rm->name);
    cnt=0;
    line[0]='\0';
    fgets(line,ARR_SIZE-1,fp);
    while (!feof(fp)) {
        sscanf(line,"%s",id);
        if (!strcmp(id,"PT:")) {
            cnt++;
            vwrite_user(user,"~FT%2d)~RS %s", cnt, remove_first(remove_first(remove_first(line))));
        }
        line[0]='\0';
        fgets(line,ARR_SIZE-1,fp);
    }
    fclose(fp);
    vwrite_user(user,"\nTotal of ~OL%d~RS messages.\n\n", rm->mesg_cnt);
}
Beispiel #23
0
/*** login_time_out is the length of time someone can idle at login, 
     user_idle_time is the length of time they can idle once logged in. 
     Also ups users total login time. ***/
void check_idle_and_timeout(void)
{
	UR_OBJECT user=user_first,next;
	int tm;

	set_crash();
/* Use while loop here instead of for loop for when user structure gets
   destructed, we may lose ->next link and crash the program */
	while (user) {
		next=user->next;
		if (user->type==CLONE_TYPE) {  user=next;  continue;  }
		user->total_login+=amsys->heartbeat; 
		if (user->level>amsys->time_out_maxlevel) {  user=next;  continue;  }
		tm=(int)(time(0) - user->last_input);
		if (user->login && tm>=amsys->login_idle_time) {
			write_user(user, login_timeout);
			disconnect_user(user);
			user=next;
			continue;
			}
		if (syspp->auto_afk
		    && tm>=syspp->auto_afk_time
		    && !user->afk
		    && !user->login) {
			afk(user, auto_afk_mesg);
			user=next;
			continue;
			}
		if (user->warned) {
			if (tm<amsys->user_idle_time-60) {  user->warned=0;  continue;  }
			if (tm>=amsys->user_idle_time) {
				write_user(user,"\n\n\07~FR~OL~LI*** You have been timed out. ***\n\n");
				disconnect_user(user);
				user=next;
				continue;
				}
			}
		if ((!user->afk || (user->afk && amsys->time_out_afks)) 
		    && !user->login 
		    && !user->warned
		    && tm>=amsys->user_idle_time-60) {
#ifdef PUEBLO
			audioprompt(user, 4, 0);
#endif
			vwrite_user(user,"\n\07~FY~OL~LI*** POZOR - Mas 1 minutu aby si nieco napisal%s lebo ta vydrbkam !***\n\n", grm_gnd(4, user->gender));
			user->warned=1;
			}
		user=next;
		}
}
Beispiel #24
0
/*
 * Change whether a rooms access is fixed or not
 */
void
change_room_fix(UR_OBJECT user, int fix)
{
  RM_OBJECT rm;
  const char *name;

  if (word_count < 2) {
    rm = user->room;
  } else {
    rm = get_room(word[1]);
    if (!rm) {
      write_user(user, nosuchroom);
      return;
    }
  }
  if (fix) {
    if (is_fixed_room(rm)) {
      if (rm == user->room) {
        write_user(user, "This room's access is already fixed.\n");
      } else {
        write_user(user, "That room's access is already fixed.\n");
      }
      return;
    }
  } else {
    if (!is_fixed_room(rm)) {
      if (rm == user->room) {
        write_user(user, "This room's access is already unfixed.\n");
      } else {
        write_user(user, "That room's access is already unfixed.\n");
      }
      return;
    }
  }
  rm->access ^= FIXED;
  reset_access(rm);
  write_syslog(SYSLOG, 1, "%s %s access to room %s.\n", user->name,
               is_fixed_room(rm) ? "FIXED" : "UNFIXED", rm->name);
  name = user->vis ? user->recap : invisname;
  if (user->room == rm) {
    vwrite_room_except(rm, user, "%s~RS has %s~RS access for this room.\n",
                       name, is_fixed_room(rm) ? "~FRFIXED" : "~FGUNFIXED");
  } else {
    vwrite_room(rm, "This room's access has been %s~RS.\n",
                is_fixed_room(rm) ? "~FRFIXED" : "~FGUNFIXED");
  }
  vwrite_user(user, "Access for room %s is now %s~RS.\n", rm->name,
              is_fixed_room(rm) ? "~FRFIXED" : "~FGUNFIXED");
}
Beispiel #25
0
/*** Read the message board ***/
void read_board(UR_OBJECT user)
{
    RM_OBJECT rm=NULL;
    char fname[FNAME_LEN], *name, rmname[ROOM_NAME_LEN+1];
    int ret;

    set_crash();
    if (word_count<2) rm=user->room;
    else {
        if (word_count>=3) {
            if ((rm=get_room(word[1]))==NULL) {
                write_user(user,nosuchroom);
                return;
            }
            read_board_specific(user,rm,atoi(word[2]));
            return;
        }
        if (word_count==2) {
            if (atoi(word[1])) {
                read_board_specific(user,user->room,atoi(word[1]));
                return;
            }
            else {
                if ((rm=get_room(word[1]))==NULL) {
                    write_user(user,nosuchroom);
                    return;
                }
            }
        }
        if (!has_room_access(user,rm)) {
            write_user(user,"That room is currently private, you cannot read the board.\n");
            return;
        }
    }
    vwrite_user(user, message_board_header, rm->name);
    if (rm->access==PERSONAL_LOCKED || rm->access==PERSONAL_UNLOCKED) {
        midcpy(rm->name,rmname,1,strlen(rm->name)-2);
        rmname[0]=toupper(rmname[0]);
        sprintf(fname,"%s/%s.B", USERROOMS, rmname);
    }
    else sprintf(fname,"%s/%s.B", ROOMFILES, rm->name);
    if (!(ret=more(user, user->socket, fname)))
        vwrite_user(user, read_no_messages, rm->name);
    else if (ret==1) user->misc_op=2;
    if (user->vis) name=user->recap;
    else name=invisname;
    if (rm==user->room) vwrite_room_except(user->room, user, user_read_board_prompt, name);
}
Beispiel #26
0
void deposit(int loc)
{
     int id ,i=0;
     int ch = 0;
     printf("issued books are\n");
     while(i<4)
     {
       if(user[loc].issue[i] != 0)
       {
          printf("%d\t",user[loc].issue[i]);
	      printf("%s",book[user[loc].issue[i]].bname);
  	      printf("\n\n");
       	  ch = 1;
	   }
	   if(ch == 0)
	   		printf("no books have been issued\n");
       i++;
    }
     printf("enter the book  id u want to deposit\n");
     scanf("%d",&id);
     for(i=0;i<4;i++)
	      if(user[loc].issue[i] == id)
		  {
                user[loc].issue[i] = 0;
                break;
          }
     book[id].check = 0;
     printf("deposit successful\n");
     write_user();
     write_books();
}
Beispiel #27
0
void update(int loc)
{
     int ch ,i ;
     char name[N];
    for(;;)
	{
		printf("\n1 - update name\n2 - update phone no\n3 - update password\n4 - exit\n");
     	scanf("%d",&ch);
        switch(ch)
          {
               case 1:printf("enter new name ...");
                      scanf("%[^\n]s", user[loc].uname);
                      // strcpy(user[loc].uname,NULL);
                      // strcpy(user[loc].uname,name);
                      break;
               case 2:user[loc].phone = 0;
                      printf("enter ur new phone no\n");
                      scanf("%lld",&user[loc].phone);
                      break;
               case 3:user[loc].pass = 0;
                      printf("enter new passsword\n\n");
                      scanf("%d",&user[loc].pass);
                      break;
               case 4:exit(0);
               default: printf("wrong choice\n");
                        break;
          }             
     write_user();
 	}
}
Beispiel #28
0
void create()
{
     int i;
	 if(user_cnt == 20)
     {
	 	printf("error.... nomore member we can have\n");
        return;
	 }
     else
     {
       // fflush(stdin);
	     printf("\nEnter ur name: ");
         scanf("%29s", user[user_cnt].uname); 
         fflush(stdin);
	     printf("Enter ur phone no.: "); 	     
         fflush(stdin);
	     scanf("%lld", &user[user_cnt].phone);
	     printf("enter password[numeicals only...6 digits max]\n");
	     scanf("%d",&user[user_cnt].pass);
	     user[user_cnt].u_id = user_cnt;
	     printf("ur user id is :%d\n",user_cnt);
	     user[user_cnt].u_id = user_cnt;
	     user_cnt++;
		 for(i=0;i<4;i++)
		 	user[user_cnt].issue[i] = 0;
	}
		write_user();
}
Beispiel #29
0
void pl02x100_start(UR_OBJECT user)
{
	int i;

	set_crash();
	if (user->pl02x100->stage>-1) {
		write_user(user,"Ved uz mas rozohratu hru.\n");
		return;
		}
	pl02x100_get_word(user->pl02x100->word);
	strcpy(user->pl02x100->word_show, user->pl02x100->word);
	for (i=0; i<strlen(user->pl02x100->word_show); ++i) user->pl02x100->word_show[i]='-';
	user->pl02x100->stage=0;
	write_user(user,"Your current hangman game status is:\n\n");
	vwrite_user(user, hanged[user->pl02x100->stage], user->pl02x100->word_show, "None yet!");
}
Beispiel #30
0
/*
 * Display user macros
 */
void
macros(UR_OBJECT user)
{
    int i;

#ifdef NETLINKS
    if (user->type == REMOTE_TYPE) {
        write_user(user,
                "Due to software limitations, remote users cannot have macros.\n");
        return;
    }
#endif
    write_user(user, "Your current macros:\n");
    for (i = 0; i < 10; ++i) {
        vwrite_user(user, "  ~OL%d)~RS %s\n", i, user->macros[i]);
    }
}