Exemplo n.º 1
0
static void print_typing (SLOT *sp)
{
  sprintf (msg_buf, "%s/%s\n", sp->acct.id, sp->acct.handle);
  writestr (cur_slot, "  ");
  begin_color (cur_slot, sp->acct.msgcolor);
  writestr (cur_slot, msg_buf);
  reset_attr (cur_slot);
}
Exemplo n.º 2
0
void exit_program( int exit_value )
{
  reset_attr( );
  if ( html_flag )
    __printf_chk( 1, "</pre>\n" );
  if ( readline_enabled && write_history( history_filename ) )
    __fprintf_chk( stderr, 1, "%s: Unable to save readline history into file \"%s\".\n", prog_name, history_filename );
  if ( exit_value == 0 && quiet_mode == 0 && html_flag == 0 )
    __printf_chk( 1, "Thank you for using Mathomatic!\n" );
  exit( exit_value );
}
Exemplo n.º 3
0
void writeaction (SLOT *sp, char *msg)
{
  select_stop (sp);
  select_wrap (sp);
  begin_attr (sp, 1);
  begin_color (sp, cur_slot->acct.msgcolor);
  writestr (sp, msg);
  reset_attr (sp);
  writech (sp, '\n');
  clear_stop (sp);
  clear_wrap (sp);
}
Exemplo n.º 4
0
void dump_userinfoshort (ACCOUNT *acct, int logged_in)
{
  ACCOUNT *cur_acct;
  long idle, hours, mins, secs;

  cur_acct = &cur_slot->acct;

  writestr (cur_slot, "Login/Handle: ");
  begin_color (cur_slot, acct->msgcolor);
  writestr (cur_slot, acct->id);
  writech (cur_slot, '/');
  writestr (cur_slot, acct->handle);
  reset_attr (cur_slot);

  writestr (cur_slot, "\nChannel: ");
  if (cur_acct->level == TOPLEVEL  ||
      channels[acct->chan].name    ||
      acct->chan == cur_acct->chan ||
      !strcmp(acct->id, cur_acct->id)) {
    writeint (cur_slot, acct->chan);
    writestr (cur_slot, "\n");
  } else
    writestr (cur_slot, "**\n");

  if (cur_acct->level >= 2 ||
      acct->email_public   ||
      !strcmp(acct->id, cur_acct->id)) {
    writestr (cur_slot, "Email address is ");
    writestr (cur_slot, acct->email_address);
    writestr (cur_slot, acct->email_public ? " [public]\n" : " [private]\n");
  } else
    writestr (cur_slot, "Email address is *PRIVATE*\n");

  writestr (cur_slot, "Last logout: ");
  writestr (cur_slot, ctime(&acct->last_logout));

  if (logged_in) {
    /* calculate idle time if the user is logged in */
    idle = time (NULL) - acct->last_typed;
    hours = idle / 3600;
    idle -= hours * 3600;
    mins = idle / 60;
    secs = idle - (mins * 60);
    sprintf (msg_buf, "Last typed: %.24s (idle: %dh %02dm %02ds)\n",
             ctime(&acct->last_typed), hours, mins, secs);
    writestr (cur_slot, msg_buf);
  } else {
    writestr (cur_slot, "Last typed: ");
    writestr (cur_slot, ctime(&acct->last_typed));
  }
}
Exemplo n.º 5
0
void paabout (SLOT *sl, char *msg)
{
  SLOT *sp;
  SLOT_LIST *slist;

  write_log_paabout (sl, msg);

  slist = channels[MAINLIST].members;
  while (slist) {
    sp = slist->slot;

    if (sp && (sp->acct.pa_notify || 
               (sl->acct.chan == sp->acct.chan))) {
      select_stop (sp);
      select_wrap (sp);
      begin_color (sp, sl->acct.msgcolor);
      if (slots_f) {
        writestr (sp, "-- #");
        writeint (sp, sl->nslot);
      } else {
        writestr (sp, "--");
      }
      writech (sp, ' ');
      writestr (sp, msg);
      writestr (sp, " channel ");
      if (sl->acct.chan == sp->acct.chan || 
          sl->flags.listed || sl->acct.chan == 1 ||
          sp->acct.level > 2)
        writetwodig (sp, sl->acct.chan);
      else
        writestr (sp, "**");
      writestr (sp, ": ");
      writestr (sp, sl->acct.id);
      writech (sp, '/');
      writestr (sp, sl->acct.handle);
      reset_attr (sp);
      writech (sp, '\n');
      clear_stop (sp);
      clear_wrap (sp);
    }
    slist = slist->next;
  }
}
Exemplo n.º 6
0
void writemsg_raw (char *msg, int color, char nlchar)
{

  select_wrap (cur_slot);
  writestr (cur_slot, "     ");
  begin_color (cur_slot, color);

  while (*msg) {
    if (*msg == nlchar)
      writestr (cur_slot, "\n  ");
    else
      writech (cur_slot, *msg);
    msg++;
  }

  reset_attr (cur_slot);
  writech (cur_slot, '\n');
  clear_wrap (cur_slot);
}
Exemplo n.º 7
0
void operact (SLOT *from, SLOT *to, char * msg)
{
  SLOT *sp;
  SLOT_LIST *sl;
  
  sl = channels[MAINLIST].members;
  while(sl) {
    sp = sl->slot;
    if (sp && sp != from && sp->acct.level > 3) {
      select_stop (sp);
      select_wrap (sp);
      if (from)
        begin_color (sp, from->acct.msgcolor);
      writestr (sp, "** ");
      if (from) {
        writestr (sp, from->acct.id);
        writech (sp, '/');
        writestr (sp, from->acct.handle);
        writech (sp, ' ');
      }
      writestr (sp, msg);
      if (to != NULL) {
        writech (sp, ' ');
        writestr (sp, to->acct.id);
        writech (sp, '/');
        writestr (sp, to->acct.handle);
      }
      if (from)
        reset_attr (sp);
      writech (sp, '\n');
      clear_stop (sp);
      clear_wrap (sp);
    }
    sl = sl->next;
  }
}
Exemplo n.º 8
0
void writemsg (SLOT *sp, char *msg, int typ)
{
  char *s;
  char *t;
  
  select_stop (sp);
  select_wrap (sp);
  begin_color (sp, cur_slot->acct.msgcolor);

  /* Emphasize personal messages */
  if (typ == 1)
    begin_attr (sp, 1);

  s = sp->acct.msgfmt;
  while (*s) {
    if (*s == '%') {
      switch (*++s) {
      case '\\': 
        writech (sp, '\\');
        break;

      case '_': 
        writech (sp, '_');
        break;

      case 'm': 
        while (*msg) {
          if (*msg == cur_slot->acct.nlchar && sp->acct.newlines)
            writestr (sp, "\n  ");
          else
            writech (sp, *msg);
          msg++;
        }
        break;
	    
      default: 
        if (shared_spec (sp, cur_slot, *s))
          break;
        writech (sp, '%');
        if (!*s)
          s--;
        else
          writech (sp, *s);
      }
    } else if (*s == '_') {
      t = (char *)index (++s, '_');
      if (typ == 2) {
        if (t != NULL)
          *t = '\0';
        writestr (sp, s);
        if (t != NULL)
          *t = '_';
      }
      if (t == NULL)
        break;
      else
        s = t;
    } else if (*s == '\\') {
      t = (char *)index (++s, '\\');
      if (typ == 1) {
        if (t != NULL)
          *t = '\0';
        writestr (sp, s);
        if (t != NULL)
          *t = '\\';
      }
      if (t == NULL)
        break;
      else
        s = t;
    } else
      writech (sp, *s);
    s++;
  }

  reset_attr (sp);
  writech (sp, '\n');
  clear_stop (sp);
  clear_wrap (sp);
}