예제 #1
0
chat_list_users( char *cbuf, int verbose )
{
  struct _chatlist cl;
  extern char global_modechar_key[];
  if (!HasPerm(C_USERS)) {
    printchatline("*** You do not have permission to list users");
    return 0;
  }
  while (*cbuf && !isspace(*cbuf)) cbuf++;
  while (*cbuf && isspace(*cbuf)) cbuf++;
  cl.start = atoi(cbuf);
  while (*cbuf && isdigit(*cbuf)) cbuf++;
  while (*cbuf && !isdigit(*cbuf)) cbuf++;
  cl.stop = atoi(cbuf);
  cl.col = 0;
  cl.verbose = verbose;
  printchatline("***");
  if (verbose) {
    sprintf(cl.buf, "*** %-14s %-25s  %-8s %s", "Userid", "Username", 
            "Mode", "From");
    printchatline(cl.buf);
    sprintf(cl.buf, "*** %-14s %-25s  %-8s %s", "------", "--------",
  	    "----", "----");
    printchatline(cl.buf);
  }
  else {
    if (global_modechar_key[0] == '\0') form_modechar_key();
    sprintf(cl.buf, "*** %s", global_modechar_key);
    printchatline(cl.buf);
    printchatline("*** ------------------------------------------------------------------------");
  }
  bbs_enum_users(t_lines-5, 0, NULL, chat_list_users_func, &cl);
  if (!verbose && cl.col > 0) printchatline(cl.buf);
  return 0;
}
예제 #2
0
파일: Nick.cpp 프로젝트: jimloco/znc
bool CNick::AddPerm(unsigned char uPerm) {
	if (!uPerm || HasPerm(uPerm)) {
		return false;
	}

	m_sChanPerms.append(1, uPerm);

	return true;
}
예제 #3
0
파일: Nick.cpp 프로젝트: jimloco/znc
unsigned char CNick::GetPermChar() const {
	CIRCSock* pIRCSock = (!m_pNetwork) ? NULL : m_pNetwork->GetIRCSock();
	const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();

	for (unsigned int a = 0; a < sChanPerms.size(); a++) {
		const unsigned char& c = sChanPerms[a];
		if (HasPerm(c)) {
			return c;
		}
	}

	return '\0';
}
예제 #4
0
CString CNick::GetPermStr() const {
	CIRCSock* pIRCSock = (!m_pUser) ? NULL : m_pUser->GetIRCSock();
	const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();
	CString sRet;

	for (unsigned int a = 0; a < sChanPerms.size(); a++) {
		const unsigned char& c = sChanPerms[a];

		if (HasPerm(c)) {
			sRet += c;
		}
	}

	return sRet;
}
예제 #5
0
chat_query_user(char *cbuf)
{
  ACCOUNT acct;
  char buf[80];
  int in_now = 0;
  while (*cbuf && !isspace(*cbuf)) cbuf++;
  while (*cbuf && isspace(*cbuf)) cbuf++;
  strip_trailing_space(cbuf);
  if (!HasPerm(C_QUERY)) {
    printchatline("*** You do not have permission to query");
    return 0;
  }
  if (*cbuf == '\0') {
    printchatline("*** You must specify a userid to query");
    return 0;
  }
  if (bbs_query(cbuf, &acct) != S_OK) {
    sprintf(buf, "*** Userid '%s' not found", cbuf);
    printchatline(buf);
    return 0;
  }     
  bbs_enum_users(20, 0, acct.userid, _query_if_logged_in, &in_now);
  printchatline("***");
  sprintf(buf, "*** %s (%s):", acct.userid, acct.username);
  printchatline(buf);
  if (acct.lastlogin == 0)
    strcpy(buf, "*** Never logged in.");
  else sprintf(buf, "*** %s from %s %s %s", 
               in_now ? "Logged in" : "Last login", 
               acct.fromhost, in_now ? "since" : "at", 
               Ctime((time_t *)&acct.lastlogin));
  printchatline(buf);
  if (acct.realname[0] != '\0') {
    sprintf(buf, "*** Real name: %s", acct.realname);
    printchatline(buf);
  }
  return 0;
}