Ejemplo n.º 1
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';
}
Ejemplo n.º 2
0
Archivo: boards.c Proyecto: Lopo/Lotos
/*** 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);
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
0
Archivo: adds.c Proyecto: 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;
  }
}
Ejemplo n.º 5
0
/*
 * Wizard moves a user to another room
 */
void
move(UR_OBJECT user)
{
  UR_OBJECT u;
  RM_OBJECT rm;
  const char *name;

  if (word_count < 2) {
    write_user(user, "Usage: move <user> [<room>]\n");
    return;
  }
  u = get_user_name(user, word[1]);
  if (!u) {
    write_user(user, notloggedon);
    return;
  }
  if (u->login) {
    write_user(user, "That user is not logged in.\n");
    return;
  }
  if (word_count < 3) {
    rm = user->room;
  } else {
    rm = get_room(word[2]);
    if (!rm) {
      write_user(user, nosuchroom);
      return;
    }
  }
  if (user == u) {
    write_user(user,
               "Trying to move yourself this way is the fourth sign of madness.\n");
    return;
  }
  if (u->level >= user->level) {
    write_user(user,
               "You cannot move a user of equal or higher level than yourself.\n");
    return;
  }
  if (rm == u->room) {
    vwrite_user(user, "%s~RS is already in the %s.\n", u->recap, rm->name);
    return;
  };
  if (!has_room_access(user, rm)) {
    vwrite_user(user,
                "The %s is currently private, %s~RS cannot be moved there.\n",
                rm->name, u->recap);
    return;
  }
  write_user(user, "~FC~OLYou chant an ancient spell...\n");
  name = user->vis ? user->recap : invisname;
  if (!user->vis) {
    write_monitor(user, user->room, 0);
  }
  vwrite_room_except(user->room, user,
                     "%s~RS ~FC~OLchants an ancient spell...\n", name);
  move_user(u, rm, 2);
  prompt(u);
}
Ejemplo n.º 6
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);
}
Ejemplo n.º 7
0
/*
 * allow a user to bump others from their personal room
 */
void
personal_room_bgone(UR_OBJECT user)
{
  RM_OBJECT rm;
  UR_OBJECT u;

  if (!amsys->personal_rooms) {
    write_user(user, "Personal room functions are currently disabled.\n");
    return;
  }
  if (word_count < 2) {
    write_user(user, "Usage: mybgone <user>/all\n");
    return;
  }
  if (strcmp(user->room->owner, user->name)) {
    write_user(user,
               "You have to be in your personal room to bounce people from it.\n");
    return;
  }
  /* get room to bounce people to */
  rm = get_room_full(amsys->default_warp);
  if (!rm) {
    write_user(user,
               "No one can be bounced from your personal room at this time.\n");
    return;
  }
  strtolower(word[1]);
  /* bounce everyone out - except GODS */
  if (!strcmp(word[1], "all")) {
    for (u = user_first; u; u = u->next) {
      if (u == user || u->room != user->room || u->level == GOD) {
        continue;
      }
      vwrite_user(user, "%s~RS is forced to leave the room.\n", u->recap);
      write_user(u, "You are being forced to leave the room.\n");
      move_user(u, rm, 0);
    }
    return;
  }
  /* send out just the one user */
  u = get_user_name(user, word[1]);
  if (!u) {
    write_user(user, notloggedon);
    return;
  }
  if (u->room != user->room) {
    vwrite_user(user, "%s~RS is not in your personal room.\n", u->recap);
    return;
  }
  if (u->level == GOD) {
    vwrite_user(user, "%s~RS cannot be forced to leave your personal room.\n",
                u->recap);
    return;
  }
  vwrite_user(user, "%s~RS is forced to leave the room.\n", u->recap);
  write_user(u, "You are being forced to leave the room.\n");
  move_user(u, rm, 0);
}
Ejemplo n.º 8
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");
}
Ejemplo n.º 9
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);
}
Ejemplo n.º 10
0
Archivo: adds.c Proyecto: Lopo/Lotos
void allxterm(UR_OBJECT user, char *inpstr)
{
	UR_OBJECT u;

	set_crash();
	for (u=user_first; u!=NULL; u=u->next) {
		if (u->login || u->type==CLONE_TYPE) continue;
		if (u->terminal.xterm) vwrite_user(u, "\033]0;%s\007", inpstr);
		else vwrite_user(user, "Window titlebar & icon changed to ~OL%s\n", inpstr);
		}
}
Ejemplo n.º 11
0
Archivo: hangman.c Proyecto: Lopo/Lotos
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");
}
Ejemplo n.º 12
0
Archivo: boards.c Proyecto: Lopo/Lotos
/*** 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);
}
Ejemplo n.º 13
0
/*
 * give some cash to another user
 */
void
donate_cash(UR_OBJECT user)
{
  UR_OBJECT u;
  const char *name;
  int cash;

  if (word_count < 3) {
    write_user(user, "Usage: donate <user> <amount>\n");
    return;
  }
  *word[1] = toupper(*word[1]);
  u = get_user_name(user, word[1]);
  if (!u) {
    write_user(user, notloggedon);
    return;
  }
  if (u == user) {
    write_user(user, "You cannot donate money to yourself.\n");
    return;
  }
  cash = atoi(word[2]);
  if (cash > MAX_DONATION) {
    vwrite_user(user, "You cannot donate more than $%d.\n", MAX_DONATION);
    return;
  }
  if (cash < 0) {
    write_user(user, "Now do not be trying to steal money from them!\n");
    return;
  }
  if (!cash) {
    write_user(user,
               "If you are going to donate money, at least donate something!\n");
    return;
  }
  if (user->money < cash) {
    write_user(user, "You have not got that much money on you right now.\n");
    return;
  }
  u->money += cash;
  user->money -= cash;
  name = user->vis || u->level < WIZ ? user->recap : invisname;
  vwrite_user(user, "You donate $%d out of your own pocket to %s~RS.\n", cash,
              u->recap);
  vwrite_user(u, "%s~RS donates $%d to you out of their own pocket.\n", name,
              cash);
  sprintf(text, "%s donates $%d.\n", user->name, cash);
  add_history(u->name, 1, text);
}
Ejemplo n.º 14
0
Archivo: boards.c Proyecto: Lopo/Lotos
/*** 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);
}
Ejemplo n.º 15
0
Archivo: adds.c Proyecto: 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");
}
Ejemplo n.º 16
0
Archivo: adds.c Proyecto: Lopo/Lotos
/* Show users who owns what room by Michael Doig*/
void room_owner(UR_OBJECT user)
{
	RM_OBJECT rm;
	int rmcnt, pcnt;
	char usrname[USER_NAME_LEN+1];
	char *line="--==[*]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-[*]==--\n";

	if (!amsys->personal_rooms) {
		write_user(user,"Personal room functions are currently disabled.\n");
		return;
		}
	strtolower(word[1]);
	rmcnt=0;
	write_user(user,"~OL~FG _              _               \n");
	write_user(user,"~OL~FG|_) _  _ ._ _  / \\    ._  _ .__\n");
	write_user(user,"~OL~FG| \\(_)(_)| | | \\_/\\/\\/| |(/_|_>\n");
	write_user(user, line);
	write_user(user,"    ~OL~FGPersonal Room Owner             Personal Room Name                       \n");
	write_user(user, line);
	for (rm=room_first; rm!=NULL; rm=rm->next) {
		if (is_personal_room(rm)) {
			pcnt=room_visitor_count(rm);
			midcpy(rm->name,usrname,1,strlen(rm->name)-2);
			usrname[0]=toupper(usrname[0]);
			vwrite_user(user,"    ~OL%-*s~RS                    ~OL%-*s~RS             ~OL~FB\n", USER_NAME_LEN,usrname,ROOM_NAME_LEN,rm->real_name);
			rmcnt++;
			}
		}
	if (!rmcnt) write_user(user,"  ~OL~FB ~RS~FRNo personal rooms are currently in memory.\n");
	write_user(user, line);
	write_user(user,"    ~RSTo visit a room, type ~FR.visit username ~FTeg. ~FR.visit andy\n");
	write_user(user, line);
	return;
}
Ejemplo n.º 17
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");
  }
}
Ejemplo n.º 18
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");
  }
}
Ejemplo n.º 19
0
Archivo: adds.c Proyecto: 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);
}
Ejemplo n.º 20
0
Archivo: macros.c Proyecto: Lopo/Lotos
void show_macros(UR_OBJECT user)
{
	int cnt=0;
	MC_OBJECT mc;

	set_crash();
	write_user(user,"~OLTvoje aktualne makra:\n");
	if (user->first_macro==NULL) {
		write_user(user, "\nNemas ziadne makro\n");
		return;
		}
	for (mc=user->first_macro; mc!=NULL; mc=mc->next) {
		cnt++;
		vwrite_user(user, "%*.*s~RS  %s~RS\n", MC_NAME_LEN, MC_NAME_LEN, mc->name, mc->comstr);
		}
	vwrite_user(user, "~OLCelkovy pocet makier: %d\n", cnt);
}
Ejemplo n.º 21
0
Archivo: adds.c Proyecto: Lopo/Lotos
void myxterm(UR_OBJECT user, char *inpstr)
{
	set_crash();
	if (!user->terminal.xterm) {
		write_user(user, "Ved nemas povoleny xterm !!!\n");
		return;
		}
	vwrite_user(user, "\033]0;%s\007", inpstr);
}
Ejemplo n.º 22
0
/*
 * show the user how much money they have
 */
void
show_money(UR_OBJECT user)
{
  if (!user->money) {
    write_user(user, "You do not have any money on you right now.\n");
    return;
  }
  vwrite_user(user, "You currently have ~OL~FC$%d~RS on you.\n", user->money);
}
Ejemplo n.º 23
0
Archivo: adds.c Proyecto: Lopo/Lotos
/* zobrazenie sklonovania nicku */
void show_nick_grm(UR_OBJECT user, UR_OBJECT u)
{
	set_crash();
	vwrite_user(user, "2. p - G: %s\n", u->nameg);
	vwrite_user(user, "3. p - D: %s\n", u->named);
	vwrite_user(user, "4. p - A: %s\n", u->namea);
	vwrite_user(user, "6. p - L: %s\n", u->namel);
	vwrite_user(user, "7. p - I: %s\n", u->namei);
	vwrite_user(user, "privl. pre muzsky rod : %s\n", u->namex);
	vwrite_user(user, "privl. pre zensky rod : %s\n", u->namey);
	vwrite_user(user, "privl. pre stredny rod: %s\n", u->namez);
}
Ejemplo n.º 24
0
/*
 * Join a user in another room
 */
void
join(UR_OBJECT user)
{
  UR_OBJECT u;
  RM_OBJECT rm;

  if (word_count < 2) {
    write_user(user, "Usage: join <user>\n");
    return;
  }
  if (user->lroom == 2) {
    write_user(user, "You have been shackled and cannot move.\n");
    return;
  }
  u = get_user_name(user, word[1]);
  if (!u) {
    write_user(user, notloggedon);
    return;
  }
  if (user == u) {
    write_user(user,
               "You really want join yourself?  What would the neighbours think?\n");
    return;
  }
  rm = u->room;
#ifdef NETLINKS
  if (!rm) {
    vwrite_user(user,
                "%s~RS is currently off site so you cannot join them.\n",
                u->recap);
    return;
  }
#endif
  if (rm == user->room) {
    vwrite_user(user, "You are already with %s~RS in the %s~RS.\n", u->recap,
                rm->show_name);
    return;
  }
  move_user(user, rm, 0);
  vwrite_user(user,
              "~FC~OLYou have joined~RS %s~RS ~FC~OLin the~RS %s~RS~FC~OL.~RS\n",
              u->recap, u->room->show_name);
}
Ejemplo n.º 25
0
/*
 * Set the room topic
 */
void
set_topic(UR_OBJECT user, char *inpstr)
{
  RM_OBJECT rm;
  const char *name;

  rm = user->room;
  if (word_count < 2) {
    if (!*rm->topic) {
      write_user(user, "No topic has been set yet.\n");
      return;
    }
    vwrite_user(user, "The current topic is: %s\n", rm->topic);
    return;
  }
  if (strlen(inpstr) > TOPIC_LEN) {
    write_user(user, "Topic too long.\n");
    return;
  }
  switch (amsys->ban_swearing) {
  case SBMAX:
    if (contains_swearing(inpstr)) {
      write_user(user, noswearing);
      return;
    }
    break;
  case SBMIN:
    if (!is_personal_room(user->room)) {
      inpstr = censor_swear_words(inpstr);
    }
    break;
  case SBOFF:
  default:
    /* do nothing as ban_swearing is off */
    break;
  }
  vwrite_user(user, "Topic set to: %s\n", inpstr);
  name = user->vis ? user->recap : invisname;
  vwrite_room_except(rm, user, "%s~RS has set the topic to: %s\n", name,
                     inpstr);
  strcpy(rm->topic, inpstr);
}
Ejemplo n.º 26
0
Archivo: ct_msg.c Proyecto: Lopo/Lotos
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");
}
Ejemplo n.º 27
0
/*
 * Show list of people suggestions are from without seeing the whole lot
 */
void
suggestions_from(UR_OBJECT user)
{
    char id[ARR_SIZE], line[ARR_SIZE], filename[80], *s, *str;
    FILE *fp;
    int valid;
    int cnt;

    if (!amsys->suggestion_count) {
        write_user(user, "There are currently no suggestions.\n");
        return;
    }
    sprintf(filename, "%s/%s", MISCFILES, SUGBOARD);
    fp = fopen(filename, "r");
    if (!fp) {
        write_user(user,
                "There was an error trying to read the suggestion board.\n");
        write_syslog(SYSLOG, 0,
                "Unable to open suggestion board in suggestions_from().\n");
        return;
    }
    vwrite_user(user, "\n~BB*** Suggestions on the %s board from ***\n\n",
            SUGBOARD);
    valid = 1;
    cnt = 0;
    for (s = fgets(line, ARR_SIZE - 1, fp); s;
            s = fgets(line, ARR_SIZE - 1, fp)) {
        if (*s == '\n') {
            valid = 1;
        }
        sscanf(s, "%s", id);
        str = colour_com_strip(id);
        if (valid && !strcmp(str, "From:")) {
            vwrite_user(user, "~FC%2d)~RS %s", ++cnt, remove_first(s));
            valid = 0;
        }
    }
    fclose(fp);
    vwrite_user(user, "\nTotal of ~OL%d~RS suggestions.\n\n",
            amsys->suggestion_count);
}
Ejemplo n.º 28
0
/*
 * Invite a user into a private room
 */
void
invite(UR_OBJECT user)
{
  UR_OBJECT u;
  RM_OBJECT rm;
  const char *name;

  if (word_count < 2) {
    write_user(user, "Invite who?\n");
    return;
  }
  rm = user->room;
  if (!is_private_room(rm)) {
    write_user(user, "This room is currently public.\n");
    return;
  }
  u = get_user_name(user, word[1]);
  if (!u) {
    write_user(user, notloggedon);
    return;
  }
  if (u == user) {
    write_user(user,
               "Inviting yourself to somewhere is the third sign of madness.\n");
    return;
  }
  if (u->room == rm) {
    vwrite_user(user, "%s~RS is already here!\n", u->recap);
    return;
  }
  if (u->invite_room == rm) {
    vwrite_user(user, "%s~RS has already been invited into here.\n",
                u->recap);
    return;
  }
  vwrite_user(user, "You invite %s~RS in.\n", u->recap);
  name = user->vis || u->level >= user->level ? user->recap : invisname;
  vwrite_user(u, "%s~RS has invited you into the %s.\n", name, rm->name);
  u->invite_room = rm;
  strcpy(u->invite_by, user->name);
}
Ejemplo n.º 29
0
Archivo: adds.c Proyecto: Lopo/Lotos
/*** Write usage of a command ***/
void write_usage(UR_OBJECT user, char *str, ...)
{
	va_list args;

	set_crash();
	vtext[0]='\0';
	va_start(args, str);
	vsprintf(vtext, str, args);
	va_end(args);
	strcpy(text, vtext);
	vwrite_user(user, "~OL>Pouzitie: ~FT%s\n", text);
}
Ejemplo n.º 30
0
Archivo: boards.c Proyecto: Lopo/Lotos
/** delete suggestions from the board **/
void delete_suggestions(UR_OBJECT user)
{
    int cnt;

    set_crash();
    if (word_count<2) {
        write_user(user,"Pouzitie: dsug all\n");
        write_user(user,"          dsug <#>\n");
        write_user(user,"          dsug to <#>\n");
        write_user(user,"          dsug from <#> to <#>\n");
        return;
    }
    if (get_wipe_parameters(user)==-1) return;
    if (!amsys->suggestion_count) {
        write_user(user,"There are no suggestions to delete.\n");
        return;
    }
    if (user->wipe_from==-1) {
        unlink(SUGBOARD);
        write_user(user,"All suggestions deleted.\n");
        write_syslog(SYSLOG,1,"%s wiped all suggestions from the suggestions board\n",user->name);
        amsys->suggestion_count=0;
        return;
    }
    if (user->wipe_from>amsys->suggestion_count) {
        vwrite_user(user,"There %s only %d suggestion%s on the board.\n",PLTEXT_IS(amsys->suggestion_count),amsys->suggestion_count,PLTEXT_S(amsys->suggestion_count));
        return;
    }
    cnt=wipe_messages(SUGBOARD, user->wipe_from,user->wipe_to,0);
    if (cnt==amsys->suggestion_count) {
        unlink(SUGBOARD);
        vwrite_user(user,"There %s only %d suggestion%s on the board, all now deleted.\n",PLTEXT_WAS(cnt),cnt,PLTEXT_S(cnt));
        write_syslog(SYSLOG,1,"%s wiped all suggestions from the suggestions board\n",user->name);
        amsys->suggestion_count=0;
        return;
    }
    amsys->suggestion_count-=cnt;
    vwrite_user(user,"%d suggestion%s deleted.\n",cnt,PLTEXT_S(cnt));
    write_syslog(SYSLOG,1,"%s wiped %d suggestion%s from the suggestions board\n",user->name,cnt,PLTEXT_S(cnt));
}