Beispiel #1
0
static void rmuser_command(ostream &out, istream &in)
{
   if (get_access_level() < ADMIN_ACCESS_LEVEL)
      {
      cout << "You must be logged in with administrator privileges\n"
	      "(access level " << ADMIN_ACCESS_LEVEL
	    << " or higher) to add users." << endl ;
      return ;
      }
   char username[200] ;

   out << "Name of user to remove: " << flush ;
   in.ignore(1000,'\n') ;
   in.getline(username,sizeof(username)) ;
   if (!retrieve_userinfo(username))
      {
      cout << "No such user!" ;
      return ;
      }
   if (remove_user(username))
      cout << "User information file updated." << endl ;
   else
      cout << "User information file update failed!" << endl ;
   return ;
}
Beispiel #2
0
static void newuser_command(ostream &out, istream &in)
{
   if (get_access_level() < ADMIN_ACCESS_LEVEL)
      {
      cout << "You must be logged in with administrator privileges\n"
	      "(access level " << ADMIN_ACCESS_LEVEL
	    << " or higher) to add users." << endl ;
      return ;
      }
   char username[200] ;
   char password[200] ;
   FrObject *ulevel ;
   int level ;

   out << "New user's name: " << flush ;
   in.ignore(1000,'\n') ;
   in.getline(username,sizeof(username)) ;
   out << "New password: "******"User's access level: " << flush ;
   in >> ulevel ;
   if (ulevel && ulevel->numberp())
      {
      level = ulevel->intValue() ;
      if (level < GUEST_ACCESS_LEVEL)
	 level = GUEST_ACCESS_LEVEL ;
      else if (level > ROOT_ACCESS_LEVEL)
	 level = ROOT_ACCESS_LEVEL ;
      }
   else
      level = GUEST_ACCESS_LEVEL ;
   FrStruct *userinfo = retrieve_userinfo(username) ;
   if (userinfo)
      {
      cout << "That user is already registered!" ;
      return ;
      }
   userinfo = make_userinfo(username,password,level) ;
   if (update_user(userinfo))
      cout << "User information file updated." << endl ;
   else
      cout << "User information file update failed!" << endl ;
   return ;
}
int do_set_modes(User *u) {
	struct u_chanlist *uc = NULL;
	char *tmp;
	Channel *c;

	/* Walk users current channels */
	for (uc = u->chans; uc; uc = uc->next) {
		if ((c = findchan(uc->chan->name)) && (c->ci)) {
			if ((get_access_level(c->ci, u->na) >= AutoOwnerLevel) && !is_founder(u, c->ci)) {
				if (!(uc->status & CUS_OWNER)) {
					tmp = stripModePrefix(ircd->ownerset);
					xanadu_cmd_mode(whosends(c->ci), c->name, "+%s %s", tmp, u->nick);
					if (tmp) free(tmp);
					chan_set_user_status(c, u, CUS_OWNER);
				}
			}
		}
	}
	return MOD_CONT;
}
int do_on_join(int argc, char **argv) {
	User *u;
	Channel *c = NULL;
	int status;
	char *tmp;

	if (!AutoOwner)
		return MOD_CONT;

	if (argc != 3)
		return MOD_CONT;

	if (stricmp(argv[0], EVENT_STOP))
		return MOD_CONT;

	if (UseTS6 && ircd->ts6) {
		u = find_byuid(argv[1]);
		if (!u)
			u = finduser(argv[1]);
	} else
		u = finduser(argv[1]);
	c = findchan(argv[2]);

	if (!c || !c->ci)
		return MOD_CONT; /* chan not registered */
	if (!u || !nick_identified(u))
		return MOD_CONT;       /* user not found/identified */

	status = chan_get_user_status(c, u);

	if ((get_access_level(c->ci, u->na) >= AutoOwnerLevel) && (!is_founder(u,c->ci))) {
		if (!(status & CUS_OWNER)) {
			tmp = stripModePrefix(ircd->ownerset);
			xanadu_cmd_mode(whosends(c->ci), c->name, "+%s %s", tmp, u->nick);
			if (tmp) free(tmp);
			chan_set_user_status(c, u, CUS_OWNER);
		}
	}
	return MOD_CONT;
}
Beispiel #5
0
static void login_command(ostream &out, istream &in)
{
   char username[200] ;
   char password[200] ;
   
   out << "User name: " << flush ;
   in.ignore(1000,'\n') ;
   in.getline(username,sizeof(username)) ;
   out << "Password: "******"Successfully logged in, at access level "
	    << get_access_level() << endl ;
      }
   else if (Fr_errno == ME_PASSWORD)
      cout << "\nUnable to login -- bad password" << endl ;
   else if (Fr_errno == ME_NOTFOUND)
      cout << "\nUnable to login -- unknown user name" << endl ;
   else
      cout << "\nUnable to login (reason unknown)." << endl ;
}