当前位置: 首页>>代码示例>>C++>>正文


C++ sendto_server函数代码示例

本文整理汇总了C++中sendto_server函数的典型用法代码示例。如果您正苦于以下问题:C++ sendto_server函数的具体用法?C++ sendto_server怎么用?C++ sendto_server使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sendto_server函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: set_topic

/*
 * set_topic
 *
 * inputs	- source_p pointer
 *		- channel pointer
 *		- topicts to set
 *		- who to set as who doing the topic
 *		- topic
 * output	- none
 * Side effects	- simply propagates topic as needed
 * little helper function, could be removed
 */
static void
set_topic(struct Client *source_p, struct Channel *chptr, time_t topicts,
          const char *topicwho, const char *topic)
{
  int new_topic = strcmp(chptr->topic ? chptr->topic : "", topic);

  set_channel_topic(chptr, topic, topicwho, topicts);

  /* Only send TOPIC to channel if it's different */
  if (new_topic)
    sendto_channel_local(ALL_MEMBERS, NO, chptr, ":%s TOPIC %s :%s",
                         ConfigServerHide.hide_servers ? me.name : source_p->name,
                         chptr->chname, chptr->topic == NULL ? "" : chptr->topic);

  sendto_server(source_p, chptr, CAP_TBURST, NOCAPS,
                ":%s TBURST %lu %s %lu %s :%s",
                me.name, (unsigned long)chptr->channelts, chptr->chname,
                (unsigned long)chptr->topic_time,
                chptr->topic_info == NULL ? "" : chptr->topic_info,
                chptr->topic == NULL ? "" : chptr->topic);
  sendto_server(source_p, chptr, CAP_TB, CAP_TBURST,
                ":%s TB %s %lu %s :%s",
                me.name, chptr->chname,
                (unsigned long)chptr->topic_time, 
                chptr->topic_info == NULL ? "" : chptr->topic_info,
                chptr->topic == NULL ? "" : chptr->topic);
}
开发者ID:KSoute,项目名称:oftc-hybrid,代码行数:39,代码来源:m_tburst.c

示例2: ms_away

static void
ms_away(struct Client *client_p, struct Client *source_p,
        int parc, char *parv[])
{
  if (!IsClient(source_p))
    return;

  if (parc < 2 || EmptyString(parv[1]))
  {
    /* Marking as not away */
    if (source_p->away[0])
    {
      /* we now send this only if they were away before --is */
      sendto_server(client_p, CAP_TS6, NOCAPS,
                    ":%s AWAY", ID(source_p));
      sendto_server(client_p, NOCAPS, CAP_TS6,
                    ":%s AWAY", source_p->name);
      source_p->away[0] = '\0';
    }

    return;
  }

  strlcpy(source_p->away, parv[1], sizeof(source_p->away));

  sendto_server(client_p, CAP_TS6, NOCAPS,
                ":%s AWAY :%s", ID(source_p), source_p->away);
  sendto_server(client_p, NOCAPS, CAP_TS6,
                ":%s AWAY :%s", source_p->name, source_p->away);
}
开发者ID:mindspeaker,项目名称:oftc-hybrid,代码行数:30,代码来源:m_away.c

示例3: mo_wallops

/*
 * mo_wallops (write to *all* opers currently online)
 *      parv[0] = sender prefix
 *      parv[1] = message text
 */
static void
mo_wallops(struct Client *client_p, struct Client *source_p,
           int parc, char *parv[])
{
    const char *message = parv[1];

    if (!HasOFlag(source_p, OPER_FLAG_WALLOPS))
    {
        sendto_one(source_p, form_str(ERR_NOPRIVS),
                   me.name, source_p->name, "wallops");
        return;
    }

    if (EmptyString(message))
    {
        sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
                   me.name, source_p->name, "WALLOPS");
        return;
    }

    sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message);
    sendto_server(NULL, CAP_TS6, NOCAPS,
                  ":%s WALLOPS :%s", ID(source_p), message);
    sendto_server(NULL, NOCAPS, CAP_TS6,
                  ":%s WALLOPS :%s", source_p->name, message);
}
开发者ID:jmaurice,项目名称:ircd-hybrid,代码行数:31,代码来源:m_wallops.c

示例4: ms_wallops

/*
 * ms_wallops (write to *all* opers currently online)
 *      parv[1] = message text
 */
static int
ms_wallops(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	const char *prefix = "";

	if(MyClient(source_p) && !IsOperWallops(source_p))
	{
		sendto_one(source_p, form_str(ERR_NOPRIVS),
				me.name, source_p->name, "wallops");

		return 0;
	}

	if (IsPerson(source_p))
	{
		if (!strncmp(parv[1], "OPERWALL - ", 11))
			prefix = "WALLOPS - ";
	}

	sendto_wallops_flags(UMODE_WALLOP, source_p, "%s%s", prefix, parv[1]);

	sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s WALLOPS :%s", 
		      use_id(source_p), parv[1]);
	sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s WALLOPS :%s", 
		      source_p->name, parv[1]);

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:32,代码来源:m_wallops.c

示例5: ms_gnotice

static void
ms_gnotice(struct Client *client_p, struct Client *source_p, int parc,
           char *parv[])
{
  char *message;
  int flags, level;

  message = parv[3];
  level = atoi(parv[2]);
  flags = atoi(parv[1]);

  if (EmptyString(message))
  {
    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
               me.name, parv[0], "GNOTICE");
    return;
  }
  
  sendto_realops_remote(source_p, flags, level, message);

  sendto_server(client_p, CAP_TS6, NOCAPS, ":%s GNOTICE %d %d :%s", ID(source_p), 
                flags, level, message);
  sendto_server(client_p, NOCAPS, CAP_TS6, ":%s GNOTICE %d %d :%s", 
                source_p->name, flags, level, message);
}
开发者ID:mindspeaker,项目名称:oftc-hybrid,代码行数:25,代码来源:m_gnotice.c

示例6: m_away

/*
** m_away
**      parv[1] = away message
*/
static int
m_away(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    if(MyClient(source_p) && source_p->localClient->next_away &&
       !IsFloodDone(source_p))
        flood_endgrace(source_p);

    if(!IsClient(source_p))
        return 0;

    if(parc < 2 || EmptyString(parv[1])) {
        /* Marking as not away */
        if(source_p->user->away != NULL) {
            /* we now send this only if they were away before --is */
            sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
                          ":%s AWAY", use_id(source_p));
            free_away(source_p);

            sendto_common_channels_local_butone(source_p, CLICAP_AWAY_NOTIFY, NOCAPS, ":%s!%[email protected]%s AWAY",
                                                source_p->name, source_p->username, source_p->host);
        }
        if(MyConnect(source_p))
            sendto_one_numeric(source_p, RPL_UNAWAY, form_str(RPL_UNAWAY));
        return 0;
    }

    /* Rate limit this because it is sent to common channels. */
    if (MyClient(source_p)) {
        if(!IsOper(source_p) &&
           source_p->localClient->next_away > rb_current_time()) {
            sendto_one(source_p, form_str(RPL_LOAD2HI),
                       me.name, source_p->name, "AWAY");
            return 0;
        }
        if(source_p->localClient->next_away < rb_current_time() -
           ConfigFileEntry.away_interval)
            source_p->localClient->next_away = rb_current_time();
        else
            source_p->localClient->next_away = rb_current_time() +
                                               ConfigFileEntry.away_interval;
    }


    if(source_p->user->away == NULL)
        allocate_away(source_p);
    if(strncmp(source_p->user->away, parv[1], AWAYLEN - 1)) {
        rb_strlcpy(source_p->user->away, parv[1], AWAYLEN);
        sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
                      ":%s AWAY :%s", use_id(source_p), source_p->user->away);
    }

    if(MyConnect(source_p))
        sendto_one_numeric(source_p, RPL_NOWAWAY, form_str(RPL_NOWAWAY));

    sendto_common_channels_local_butone(source_p, CLICAP_AWAY_NOTIFY, NOCAPS, ":%s!%[email protected]%s AWAY :%s",
                                        source_p->name, source_p->username, source_p->host,
                                        source_p->user->away);

    return 0;
}
开发者ID:CustomIRCd,项目名称:elemental-ircd,代码行数:64,代码来源:m_away.c

示例7: mo_operwall

/*
 * mo_operwall - OPERWALL message handler
 *  (write to *all* local opers currently online)
 *      parv[0] = sender prefix
 *      parv[1] = message text
 */
static void
mo_operwall(struct Client *client_p, struct Client *source_p,
            int parc, char *parv[])
{
  const char *message = parv[1];

  if (!IsOperWall(source_p))
  {
    sendto_one(source_p, form_str(ERR_NOPRIVS),
               me.name, source_p->name, "operwall");
    return;
  }

  if (EmptyString(message))
  {
    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
               me.name, source_p->name, "OPERWALL");
    return;
  }

  sendto_server(NULL, source_p, NULL, CAP_TS6, NOCAPS, LL_ICLIENT,
                ":%s OPERWALL :%s", ID(source_p), message);
  sendto_server(NULL, source_p, NULL, NOCAPS, CAP_TS6, LL_ICLIENT,
                ":%s OPERWALL :%s", source_p->name, message);
  sendto_wallops_flags(UMODE_OPERWALL, source_p, "OPERWALL - %s", message);
}
开发者ID:Stanford-Online,项目名称:edx_irc_chat,代码行数:32,代码来源:m_operwall.c

示例8: mr_user

/*
** mr_user
**      parv[0] = sender prefix
**      parv[1] = username (login name, account)
**      parv[2] = client host name (used only from other servers)
**      parv[3] = server host name (used only from other servers)
**      parv[4] = users real name info
*/
static void
mr_user(struct Client *client_p, struct Client *source_p,
        int parc, char *parv[])
{
  char *p;
  char *user;

  if (source_p->localClient->listener->flags & LISTENER_SERVER)
  {
    exit_client(source_p, &me, "Use a different port");
    return;
  }

  if ((p = strchr(parv[1], '@')) != NULL)
    *p = '\0'; 

  if (EmptyString(parv[4]))
  {
    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name,
               source_p->name[0] ? source_p->name : "*", "USER");
    return;
  }

  if(!EmptyString(source_p->name))
  {
    user = parv[1];
    if(*user == '&')
    {
      user++;
      if(EmptyString(user))
        user = parv[1];
      else
      {
        if(!EmptyString(source_p->certfp))
        {
          char buf[SHA_DIGEST_LENGTH*2+1];

          base16_encode(buf, sizeof(buf), source_p->certfp, sizeof(source_p->certfp));
          sendto_server(&me, NULL, NOCAPS, NOCAPS, ":%s AUTH 1 %s %s %s", me.name,
              user, source_p->name, buf);
        }
        else
        {
          sendto_server(&me, NULL, NOCAPS, NOCAPS, ":%s AUTH 0 %s %s %s", me.name,
              user, source_p->name, source_p->localClient->passwd);
        }
        
        strlcpy(source_p->info, parv[4], sizeof(source_p->info));

        return;
      }
    }
  }

  do_local_user(parv[0], client_p, source_p,
                parv[1], /* username */
                parv[2], /* host     */
                parv[3], /* server   */
                parv[4]	 /* users real name */ );
}
开发者ID:KSoute,项目名称:oftc-hybrid,代码行数:68,代码来源:m_user.c

示例9: ms_away

/*! \brief AWAY command handler
 *
 * \param source_p Pointer to allocated Client struct from which the message
 *                 originally comes from.  This can be a local or remote client.
 * \param parc     Integer holding the number of supplied arguments.
 * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
 *                 pointers.
 * \note Valid arguments for this command are:
 *      - parv[0] = command
 *      - parv[1] = away message
 */
static int
ms_away(struct Client *source_p, int parc, char *parv[])
{
  const char *const message = parv[1];

  if (EmptyString(message))
  {
    /* Marking as not away */
    if (source_p->away[0])
    {
      source_p->away[0] = '\0';

      /* We now send this only if they were away before --is */
      sendto_server(source_p, 0, 0, ":%s AWAY", source_p->id);
      sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, ":%s!%[email protected]%s AWAY",
                                   source_p->name, source_p->username,
                                   source_p->host);
    }

    return 0;
  }

  strlcpy(source_p->away, message, sizeof(source_p->away));

  sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, ":%s!%[email protected]%s AWAY :%s",
                               source_p->name, source_p->username,
                               source_p->host, source_p->away);
  sendto_server(source_p, 0, 0, ":%s AWAY :%s",
                source_p->id, source_p->away);
  return 0;
}
开发者ID:nask0,项目名称:ircd-hybrid,代码行数:42,代码来源:m_away.c

示例10: mo_chghost

/* Disable this because of the abuse potential -- jilles
 * No, make it toggleable via ./configure. --nenolod
 */
static int
mo_chghost(struct Client *client_p, struct Client *source_p,
           int parc, const char *parv[])
{
    struct Client *target_p;

    if(!IsOperAdmin(source_p)) {
        sendto_one(source_p, form_str(ERR_NOPRIVS),
                   me.name, source_p->name, "admin");
        return 0;
    }

    if (!(target_p = find_named_person(parv[1]))) {
        sendto_one_numeric(source_p, ERR_NOSUCHNICK,
                           form_str(ERR_NOSUCHNICK), parv[1]);
        return 0;
    }

    if (!clean_host(parv[2])) {
        sendto_one_notice(source_p, ":Hostname %s is invalid", parv[2]);
        return 0;
    }

    do_chghost(source_p, target_p, parv[2], 0);

    sendto_server(NULL, NULL,
                  CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s %s",
                  use_id(source_p), use_id(target_p), parv[2]);
    sendto_server(NULL, NULL,
                  CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
                  use_id(source_p), use_id(target_p), parv[2]);
    return 0;
}
开发者ID:HelenaKitty,项目名称:ircd-kaffe,代码行数:36,代码来源:m_chghost.c

示例11: ms_topic

static void
ms_topic(struct Client *client_p, struct Client *source_p,
         int parc, char *parv[])
{
  struct Channel *chptr = NULL;
  const char *from, *to;
  char topic_info[USERHOST_REPLYLEN];

  if (IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
  {
    from = me.id;
    to = source_p->id;
  }
  else
  {
    from = me.name;
    to = source_p->name;
  }

  if (EmptyString(parv[1]))
  {
    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
               from, to, "TOPIC");
    return;
  }

  if ((chptr = hash_find_channel(parv[1])) == NULL)
  {
    sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
               from, to, parv[1]);
    return;
  }

  if (!IsClient(source_p))
    strlcpy(topic_info, source_p->name, sizeof(topic_info));
  else
    snprintf(topic_info, sizeof(topic_info), "%s!%[email protected]%s", source_p->name,
             source_p->username, source_p->host);
  set_channel_topic(chptr, parv[2], topic_info, CurrentTime, 0);

  sendto_server(client_p, CAP_TS6, NOCAPS, ":%s TOPIC %s :%s",
                ID(source_p), chptr->chname,
                chptr->topic);
  sendto_server(client_p, NOCAPS, CAP_TS6, ":%s TOPIC %s :%s",
                source_p->name, chptr->chname,
                chptr->topic);

  if (!IsClient(source_p))
    sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s TOPIC %s :%s",
                         source_p->name,
                         chptr->chname, chptr->topic);

  else
    sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%[email protected]%s TOPIC %s :%s",
                         source_p->name,
                         source_p->username,
                         source_p->host,
                         chptr->chname, chptr->topic);
}
开发者ID:jmaurice,项目名称:ircd-hybrid,代码行数:59,代码来源:m_topic.c

示例12: part_one_client

/* part_one_client()
 *
 * inputs	- pointer to server
 * 		- pointer to source client to remove
 *		- char pointer of name of channel to remove from
 * output	- none
 * side effects	- remove ONE client given the channel name 
 */
static void
part_one_client(struct Client *client_p, struct Client *source_p,
                const char *name, char *reason)
{
  struct Channel *chptr = NULL;
  struct Membership *ms = NULL;

  if ((chptr = hash_find_channel(name)) == NULL)
  {
    sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
               me.name, source_p->name, name);
    return;
  }

  if ((ms = find_channel_link(source_p, chptr)) == NULL)
  {
    sendto_one(source_p, form_str(ERR_NOTONCHANNEL),
               me.name, source_p->name, name);
    return;
  }

  if (MyConnect(source_p) && !IsOper(source_p))
    check_spambot_warning(source_p, NULL);

  /*
   *  Remove user from the old channel (if any)
   *  only allow /part reasons in -m chans
   */
  if(msg_has_colors(reason) && (chptr->mode.mode & MODE_NOCOLOR)) 
    reason = strip_color(reason); 
  
  if (reason[0] && (!MyConnect(source_p) ||
      ((can_send(chptr, source_p, ms) &&
       (source_p->firsttime + ConfigFileEntry.anti_spam_exit_message_time)
        < CurrentTime))))
  {
    sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                  ":%s PART %s :%s", ID(source_p), chptr->chname,
                  reason);
    sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
                  ":%s PART %s :%s", source_p->name, chptr->chname,
                  reason);
    sendto_channel_local(ALL_MEMBERS, NO, chptr, ":%s!%[email protected]%s PART %s :%s",
                         source_p->name, source_p->username,
                         source_p->host, chptr->chname, reason);
  }
  else
  {
    sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                  ":%s PART %s", ID(source_p), chptr->chname);
    sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
                  ":%s PART %s", source_p->name, chptr->chname);
    sendto_channel_local(ALL_MEMBERS, NO, chptr, ":%s!%[email protected]%s PART %s",
                         source_p->name, source_p->username,
                         source_p->host, chptr->chname);
  }

  remove_user_from_channel(ms);
}
开发者ID:KSoute,项目名称:oftc-hybrid,代码行数:67,代码来源:m_part.c

示例13: mo_away

static void
mo_away(struct Client *client_p, struct Client *source_p,
        int parc, char *parv[])
{
  char *cur_away_msg = source_p->user->away;
  char *new_away_msg;
  size_t nbytes = 0;

  if (!IsFloodDone(source_p))
    flood_endgrace(source_p);

  if (parc < 2 || EmptyString(parv[1]))
  {
    /* Marking as not away */
    if (cur_away_msg)
    {
      /* we now send this only if they were away before --is */
      sendto_server(client_p, source_p, NULL, CAP_TS6, NOCAPS,
                    NOFLAGS, ":%s AWAY", ID(source_p));
      sendto_server(client_p, source_p, NULL, NOCAPS, CAP_TS6,
                    NOFLAGS, ":%s AWAY", source_p->name);

      MyFree(cur_away_msg);
      source_p->user->away = NULL;
    }

    sendto_one(source_p, form_str(RPL_UNAWAY),
               me.name, parv[0]);
    return;
  }

  source_p->user->last_away = CurrentTime;
  new_away_msg              = parv[1];

  nbytes = strlen(new_away_msg);
  if (nbytes > (size_t)TOPICLEN) {
    new_away_msg[TOPICLEN] = '\0';
    nbytes = TOPICLEN;
  }

  /* we now send this only if they
   * weren't away already --is */
  if (!cur_away_msg)
  {
    sendto_server(client_p, source_p, NULL, CAP_TS6, NOCAPS,
                  NOFLAGS, ":%s AWAY :%s", ID(source_p), new_away_msg);
    sendto_server(client_p, source_p, NULL, NOCAPS, CAP_TS6,
                  NOFLAGS, ":%s AWAY :%s", source_p->name, new_away_msg);
  }
  else
    MyFree(cur_away_msg);

  cur_away_msg = MyMalloc(nbytes + 1);
  strcpy(cur_away_msg, new_away_msg);
  source_p->user->away = cur_away_msg;

  sendto_one(source_p, form_str(RPL_NOWAWAY), me.name, parv[0]);
}
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:58,代码来源:m_away.c

示例14: m_cycle

static int
m_cycle(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    char *p, *name;
    char *s = LOCAL_COPY(parv[1]);
    struct Channel *chptr;
    struct membership *msptr;

    name = rb_strtok_r(s, ",", &p);

    /* Finish the flood grace period... */
    if(MyClient(source_p) && !IsFloodDone(source_p))
        flood_endgrace(source_p);

    while(name) {
        if((chptr = find_channel(name)) == NULL) {
            sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
            return 0;
        }

        msptr = find_channel_membership(chptr, source_p);
        if(msptr == NULL) {
            sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
            return 0;
        }

        if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
            check_spambot_warning(source_p, NULL);

        if((is_any_op(msptr) || !MyConnect(source_p) ||
            ((can_send(chptr, source_p, msptr) > 0 &&
              (source_p->localClient->firsttime +
               ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) {
            sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                          ":%s PART %s :Cycling", use_id(source_p), chptr->chname);
            sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :Cycling",
                                 source_p->name, source_p->username,
                                 source_p->host, chptr->chname);
        } else {
            sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                          ":%s PART %s", use_id(source_p), chptr->chname);
            sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s",
                                 source_p->name, source_p->username,
                                 source_p->host, chptr->chname);
        }

        remove_user_from_channel(msptr);

        chptr = NULL;
        msptr = NULL;

        name = rb_strtok_r(NULL, ",", &p);
    }

    user_join(client_p, source_p, parv[1], parc > 2 ? parv[2] : NULL);

    return 0;
}
开发者ID:Cloudxtreme,项目名称:elemental-ircd,代码行数:58,代码来源:m_cycle.c

示例15: part_one_client

/*
 * part_one_client
 *
 * inputs	- pointer to server
 * 		- pointer to source client to remove
 *		- char pointer of name of channel to remove from
 * output	- none
 * side effects	- remove ONE client given the channel name 
 */
static void
part_one_client(struct Client *client_p, struct Client *source_p, char *name, char *reason)
{
	struct Channel *chptr;
	struct membership *msptr;

	if((chptr = find_channel(name)) == NULL)
	{
		sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
				   form_str(ERR_NOSUCHCHANNEL), name);
		return;
	}

	msptr = find_channel_membership(chptr, source_p);
	if(msptr == NULL)
	{
		sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
				   form_str(ERR_NOTONCHANNEL), name);
		return;
	}

	if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
		check_spambot_warning(source_p, NULL);

	/*
	 *  Remove user from the old channel (if any)
	 *  only allow /part reasons in -m chans
	 */
	if(reason[0] && (is_chanop(msptr) || !MyConnect(source_p) ||
			 ((can_send(chptr, source_p, msptr) > 0 &&
			   (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time)
			   < CurrentTime))))
	{
		sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
				":%s PART %s :%s",
				use_id(source_p), chptr->chname, reason);
		sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
				":%s PART %s :%s",
				source_p->name, chptr->chname, reason);
		sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :%s",
					source_p->name, source_p->username,
					source_p->host, chptr->chname, reason);
	}
	else
	{
		sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
				":%s PART %s",
				use_id(source_p), chptr->chname);
		sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
				":%s PART %s",
				source_p->name, chptr->chname);
		sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s",
					source_p->name, source_p->username,
					source_p->host, chptr->chname);
	}
	remove_user_from_channel(msptr);
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:66,代码来源:m_part.c


注:本文中的sendto_server函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。