Esempio n. 1
0
chat_list_users_func( int indx, USEREC *urec, struct _chatlist *cl )
{
  indx++;    /* Start counting at one, not zero. */
  if (indx < cl->start) return S_OK;
  else if (cl->stop && (indx > cl->stop)) return ENUM_QUIT;
  if (cl->verbose) {
    char fromhost[24];
    memset(fromhost, '\0', sizeof fromhost);
    strncpy(fromhost, urec->fromhost, sizeof(fromhost)-1);
    sprintf(cl->buf, "*** %-14s %-25s %c%-8s %-23s", 
  	    urec->userid, urec->username,
	    BITISSET(urec->flags, FLG_CLOAK) ? '#' : ' ',
	    ModeToString(urec->mode), fromhost);
    printchatline(cl->buf);
  }
  else {
    if (cl->col == 0) {
      strcpy(cl->buf, "*** ");
      cl->col = 4;
    }     
    sprintf(cl->buf+cl->col, "[%c]%s%-13s ", ModeToChar(urec->mode), 
            BITISSET(urec->flags, FLG_CLOAK) ? " #" : " ", urec->userid);
    if ((cl->col += 18) > 70) {
      printchatline(cl->buf);
      cl->col = 0;
    }          
  }
  return S_OK;
}
Esempio n. 2
0
 File::File(const String *path, File::Mode mode) :
     mFile(std::fopen(path->getCString(), ModeToString(mode))),
     mHasOwnership(true)
 {
     if(!mFile) {
         throw Exception((String::Builder() << "opening file failed with error " << stderr), nullptr);
     }
 }
Esempio n. 3
0
form_modechar_key()
{
  SHORT i;
  int left;
  char c, *s, buf[20];
  strcpy(global_modechar_key, "Key:");
  left = sizeof(global_modechar_key) - 5;
  for (i=0; i<=BBS_MAX_MODE; i++) {
    c = ModeToChar(i);
    if (c == ' ') continue;
    s = ModeToString(i);
    sprintf(buf, " [%c]", c);
    if (toupper(c) == toupper(*s)) strncat(buf+4, s+1, 10);
    else strncat(buf+4, s, 10);
    if (left > strlen(buf)) {
      strcat(global_modechar_key, buf);
      left -= strlen(buf);
    }
  }
  return 0;
}
Esempio n. 4
0
/*ARGSUSED*/
OnlineUsersFunc( int indx, USEREC *urec, struct enum_info *info )
{
  if (info->topline == info->currline) {
    move(info->topline-1, 0);
    prints("%-12s    %-25s %-25s %s %s\n", 
	   "User Id", "User Name", "From", "P", "Mode");
  }

  prints("%-12s  %c %-25s %-25s %c %s\n", urec->userid, 
	 BITISSET(urec->flags, FLG_CLOAK) ? '#': ' ', 
	 urec->username, urec->fromhost, 
	 BITISSET(urec->flags, FLG_NOPAGE) ? 'N': ' ', 
         ModeToString(urec->mode));

  info->currline++;
  info->count++;

  if (info->currline > info->bottomline) {
    int ch;
    standout();
    prints("--MORE--");
    standend();
    clrtoeol();
    while((ch = igetch()) != EOF) {
      if(ch == '\n' || ch == '\r' || ch == ' ')
	break;
      if(toupper(ch) == 'Q') {
	move(info->currline, 0);
	clrtoeol();
	return ENUM_QUIT;
      }
      else bell();
    }
    info->currline = info->topline;
  }
  return S_OK;
}