コード例 #1
0
ファイル: icec-mercbase.c プロジェクト: onjin/astral
void icec_showchannel(ice_channel *c, const char *from, const char *txt, int emote)
{
  DESCRIPTOR_DATA *d, *dnext;
  CHAR_DATA *ch;
  char buf[MAX_STRING_LENGTH];

  if (!c->local)
    return;
  
  sprintf(buf, emote ? c->local->format2 : c->local->format1, from, color_itom(txt));
  strcat(buf, "\n\r");
  
  for (d=descriptor_list; d; d=dnext)
  {
    dnext=d->next;

    ch=d->original ? d->original : d->character;

    if (!ch ||
	IS_NPC(ch) ||
	get_trust(ch) < c->local->level ||
	!ice_audible(c, imc_makename(ch->name, imc_name)) ||
	!imc_hasname(ch->pcdata->ice_listen, c->local->name))
      continue;

    send_to_char(buf, ch);
  }
}
コード例 #2
0
ファイル: icec.c プロジェクト: benjamin-small/GodWars
void icec_recv_update(const char *from,
                      const char *chan,
                      const char *owner,
                      const char *operators,
                      const char *policy,
                      const char *invited,
                      const char *excluded) {
    ice_channel *c;
    const char *mud;
    mud = imc_mudof(from);
    /* forged? */
    if(!strchr(chan, ':') ||
            strcasecmp(mud, ice_mudof(chan))) {
        return;
    }
    c = icec_findchannel(chan);
    if(!c) {
        c = imc_malloc(sizeof(*c));
        c->name = imc_strdup(chan);
        c->owner = imc_strdup(owner);
        c->operators = imc_strdup(operators);
        c->invited = imc_strdup(invited);
        c->excluded = imc_strdup(excluded);
        c->local = NULL;
        c->active = NULL;
        c->next = icec_channel_list;
        icec_channel_list = c;
    } else {
        imc_strfree(c->owner);
        imc_strfree(c->operators);
        imc_strfree(c->invited);
        imc_strfree(c->excluded);
        c->name = imc_strdup(chan);
        c->owner = imc_strdup(owner);
        c->operators = imc_strdup(operators);
        c->invited = imc_strdup(invited);
        c->excluded = imc_strdup(excluded);
    }
    if(!strcasecmp(policy, "open")) {
        c->policy = ICE_OPEN;
    } else if(!strcasecmp(policy, "closed")) {
        c->policy = ICE_CLOSED;
    } else {
        c->policy = ICE_PRIVATE;
    }
    if(c->local && !ice_audible(c, imc_name)) {
        icec_localfree(c);
    }
    icec_notify_update(c);
    imc_cancel_event(ev_icec_timeout, c);
    imc_add_event(ICEC_TIMEOUT, ev_icec_timeout, c, 0);
}
コード例 #3
0
ファイル: icec-mercbase.c プロジェクト: onjin/astral
/* check for icec channels, return TRUE to stop command processing, FALSE otherwise */
bool icec_command_hook(CHAR_DATA *ch, const char *command, const char *argument)
{
  ice_channel *c;
  char arg[MAX_STRING_LENGTH];
  const char *word2;
  int emote=0;
  
  if (IS_NPC(ch))
    return FALSE;
  
#ifdef CIRCLE
  skip_spaces(&argument);
#endif
  
  c=icec_findlchannel(command);
  if (!c || !c->local)
    return FALSE;

  if (c->local->level > get_trust(ch))
    return FALSE;

  if (!imc_hasname(ch->pcdata->ice_listen, c->local->name))
    return FALSE;
  
  if (!ice_audible(c, imc_makename(ch->name, imc_name)))
  {
    send_to_char("You cannot use that channel.\n\r", ch);
    return TRUE;
  }

  word2=imc_getarg(argument, arg, MAX_STRING_LENGTH);

  if (!arg[0])
  {
    send_to_char("Use ichan to toggle the channel - or provide some text.\n\r", ch);
    return TRUE;
  }

  if (!str_cmp(arg, ",") ||
      !str_cmp(arg, "emote"))
  {
    emote=1;
    argument=word2;
  }
  
  icec_sendmessage(c, ch->name, color_mtoi(argument), emote);
  return TRUE;
}
コード例 #4
0
ファイル: icec.c プロジェクト: benjamin-small/GodWars
void icec_recv_msg_b(const char *from,
                     const char *chan,
                     const char *txt,
                     int emote) {
    ice_channel *c;
    c = icec_findchannel(chan);
    if(!c) {
        return;
    }
    if(!c->local || c->policy == ICE_PRIVATE) {
        return;
    }
    if(!ice_audible(c, from)) {
        return;
    }
    icec_showchannel(c, from, txt, emote);
}