• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IRC_WriteStrClient函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: join_send_topic

/**
 * Acknowledge user JOIN request and send "channel info" numerics.
 *
 * @param Client	Client used to prefix the genrated commands
 * @param target	Forward commands/numerics to this user
 * @param chan		Channel structure
 * @param channame	Channel name
 */
static bool
join_send_topic(CLIENT *Client, CLIENT *target, CHANNEL *chan,
					const char *channame)
{
	const char *topic;

	if (Client_Type(Client) != CLIENT_USER)
		return true;
	/* acknowledge join */
	if (!IRC_WriteStrClientPrefix(Client, target, "JOIN :%s", channame))
		return false;

	/* Send topic to client, if any */
	topic = Channel_Topic(chan);
	assert(topic != NULL);
	if (*topic) {
		if (!IRC_WriteStrClient(Client, RPL_TOPIC_MSG,
			Client_ID(Client), channame, topic))
				return false;
#ifndef STRICT_RFC
		if (!IRC_WriteStrClient(Client, RPL_TOPICSETBY_MSG,
			Client_ID(Client), channame,
			Channel_TopicWho(chan),
			Channel_TopicTime(chan)))
				return false;
#endif
	}
	/* send list of channel members to client */
	if (!IRC_Send_NAMES(Client, chan))
		return false;
	return IRC_WriteStrClient(Client, RPL_ENDOFNAMES_MSG, Client_ID(Client),
				  Channel_Name(chan));
} /* join_send_topic */
开发者ID:andinue,项目名称:ngircd,代码行数:41,代码来源:irc-channel.c


示例2: Channel_Part

/**
 * Part client from channel.
 * This function lets a client part from a channel. First, the function checks
 * if the channel exists and the client is a member of it and sends out
 * appropriate error messages if not. The real work is done by the function
 * Remove_Client().
 */
GLOBAL bool
Channel_Part(CLIENT * Client, CLIENT * Origin, const char *Name, const char *Reason)
{
	CHANNEL *chan;

	assert(Client != NULL);
	assert(Name != NULL);
	assert(Reason != NULL);

	/* Check that specified channel exists */
	chan = Channel_Search(Name);
	if (!chan) {
		IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
				   Client_ID(Client), Name);
		return false;
	}

	/* Check that the client is in the channel */
	if (!Get_Cl2Chan(chan, Client)) {
		IRC_WriteStrClient(Client, ERR_NOTONCHANNEL_MSG,
				   Client_ID(Client), Name);
		return false;
	}

	if (Conf_MorePrivacy)
		Reason = "";

	/* Part client from channel */
	if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true))
		return false;
	else
		return true;
} /* Channel_Part */
开发者ID:husemann,项目名称:ngircd,代码行数:40,代码来源:channel.c


示例3: Help

/**
 * Send help for a given topic to the client.
 *
 * @param Client The client requesting help.
 * @param Topic The help topic requested.
 * @return CONNECTED or DISCONNECTED.
 */
static bool
Help(CLIENT *Client, const char *Topic)
{
	char *line;
	size_t helptext_len, len_str, idx_start, lines = 0;
	bool in_article = false;

	assert(Client != NULL);
	assert(Topic != NULL);

	helptext_len = array_bytes(&Conf_Helptext);
	line = array_start(&Conf_Helptext);
	while (helptext_len > 0) {
		len_str = strlen(line) + 1;
		assert(helptext_len >= len_str);
		helptext_len -= len_str;

		if (in_article) {
			/* The first character in each article text line must
			 * be a TAB (ASCII 9) character which will be stripped
			 * in the output. If it is not a TAB, the end of the
			 * article has been reached. */
			if (line[0] != '\t') {
				if (lines > 0)
					return CONNECTED;
				else
					break;
			}

			/* A single '.' character indicates an empty line */
			if (line[1] == '.' && line[2] == '\0')
				idx_start = 2;
			else
				idx_start = 1;

			if (!IRC_WriteStrClient(Client, "NOTICE %s :%s",
						Client_ID(Client),
						&line[idx_start]))
				return DISCONNECTED;
			lines++;

		} else {
			if (line[0] == '-' && line[1] == ' '
			    && strcasecmp(&line[2], Topic) == 0)
				in_article = true;
		}

		line += len_str;
	}

	/* Help topic not found (or empty)! */
	if (!IRC_WriteStrClient(Client, "NOTICE %s :No help for \"%s\" found!",
				Client_ID(Client), Topic))
		return DISCONNECTED;

	return CONNECTED;
}
开发者ID:ngircd,项目名称:ngircd,代码行数:64,代码来源:irc.c


示例4: Login_User_PostAuth

/**
 * Finish client registration.
 *
 * Introduce the new client to the network and send all "hello messages"
 * to it after authentication has been succeeded.
 *
 * @param Client The client logging in.
 * @return CONNECTED or DISCONNECTED.
 */
GLOBAL bool
Login_User_PostAuth(CLIENT *Client)
{
	REQUEST Req;
	char modes[CLIENT_MODE_LEN + 1];

	assert(Client != NULL);

	if (Class_HandleServerBans(Client) != CONNECTED)
		return DISCONNECTED;

	Client_Introduce(NULL, Client, CLIENT_USER);

	if (!IRC_WriteStrClient
	    (Client, RPL_WELCOME_MSG, Client_ID(Client), Client_Mask(Client)))
		return false;
	if (!IRC_WriteStrClient
	    (Client, RPL_YOURHOST_MSG, Client_ID(Client),
	     Client_ID(Client_ThisServer()), PACKAGE_VERSION, HOST_CPU,
	     HOST_VENDOR, HOST_OS))
		return false;
	if (!IRC_WriteStrClient
	    (Client, RPL_CREATED_MSG, Client_ID(Client), NGIRCd_StartStr))
		return false;
	if (!IRC_WriteStrClient
	    (Client, RPL_MYINFO_MSG, Client_ID(Client),
	     Client_ID(Client_ThisServer()), PACKAGE_VERSION, USERMODES,
	     CHANMODES))
		return false;

	/* Features supported by this server (005 numeric, ISUPPORT),
	 * see <http://www.irc.org/tech_docs/005.html> for details. */
	if (!IRC_Send_ISUPPORT(Client))
		return DISCONNECTED;

	if (!IRC_Send_LUSERS(Client))
		return DISCONNECTED;
	if (!IRC_Show_MOTD(Client))
		return DISCONNECTED;

	/* Set default user modes */
	if (Conf_DefaultUserModes[0]) {
		snprintf(modes, sizeof(modes), "+%s", Conf_DefaultUserModes);
		Req.prefix = Client_ID(Client_ThisServer());
		Req.command = "MODE";
		Req.argc = 2;
		Req.argv[0] = Client_ID(Client);
		Req.argv[1] = modes;
		IRC_MODE(Client, &Req);
	} else
		IRC_SetPenalty(Client, 1);

	return CONNECTED;
}
开发者ID:LucentW,项目名称:ngircd,代码行数:63,代码来源:login.c


示例5: Channel_Mode_Answer_Request

/*
 * Reply to a channel mode request.
 *
 * @param Origin The originator of the MODE command (prefix).
 * @param Channel The channel of which the modes should be sent.
 * @return CONNECTED or DISCONNECTED.
 */
static bool
Channel_Mode_Answer_Request(CLIENT *Origin, CHANNEL *Channel)
{
	char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], argadd[CLIENT_PASS_LEN];
	const char *mode_ptr;

	if (!Channel_IsMemberOf(Channel, Origin)) {
		/* Not a member: "simple" mode reply */
		if (!IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG,
					Client_ID(Origin), Channel_Name(Channel),
					Channel_Modes(Channel)))
			return DISCONNECTED;
	} else {
		/* The sender is a member: generate extended reply */
		strlcpy(the_modes, Channel_Modes(Channel), sizeof(the_modes));
		mode_ptr = the_modes;
		the_args[0] = '\0';

		while(*mode_ptr) {
			switch(*mode_ptr) {
			case 'l':
				snprintf(argadd, sizeof(argadd), " %lu",
					 Channel_MaxUsers(Channel));
				strlcat(the_args, argadd, sizeof(the_args));
				break;
			case 'k':
				strlcat(the_args, " ", sizeof(the_args));
				strlcat(the_args, Channel_Key(Channel),
					sizeof(the_args));
				break;
			}
			mode_ptr++;
		}
		if (the_args[0])
			strlcat(the_modes, the_args, sizeof(the_modes));

		if (!IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG,
					Client_ID(Origin), Channel_Name(Channel),
					the_modes))
			return DISCONNECTED;
	}

#ifndef STRICT_RFC
	/* Channel creation time */
	if (!IRC_WriteStrClient(Origin, RPL_CREATIONTIME_MSG,
				  Client_ID(Origin), Channel_Name(Channel),
				  Channel_CreationTime(Channel)))
		return DISCONNECTED;
#endif
	return CONNECTED;
}
开发者ID:LucentW,项目名称:ngircd,代码行数:58,代码来源:irc-mode.c


示例6: IRC_HELP

/**
 * Handler for the IRC "HELP" command.
 *
 * @param Client The client from which this command has been received.
 * @param Req Request structure with prefix and all parameters.
 * @return CONNECTED or DISCONNECTED.
 */
GLOBAL bool
IRC_HELP(CLIENT *Client, REQUEST *Req)
{
	COMMAND *cmd;

	assert(Client != NULL);
	assert(Req != NULL);

	if ((Req->argc == 0 && array_bytes(&Conf_Helptext) > 0)
	    || (Req->argc >= 1 && strcasecmp(Req->argv[0], "Commands") != 0)) {
		/* Help text available and requested */
		if (Req->argc >= 1)
			return Help(Client, Req->argv[0]);

		if (!Help(Client, "Intro"))
			return DISCONNECTED;
		return CONNECTED;
	}

	cmd = Parse_GetCommandStruct();
	while(cmd->name) {
		if (!IRC_WriteStrClient(Client, "NOTICE %s :%s",
					Client_ID(Client), cmd->name))
			return DISCONNECTED;
		cmd++;
	}
	return CONNECTED;
} /* IRC_HELP */
开发者ID:ngircd,项目名称:ngircd,代码行数:35,代码来源:irc.c


示例7: Channel_Join

/**
 * Join Channel
 * This function lets a client join a channel.  First, the function
 * checks that the specified channel name is valid and that the client
 * isn't already a member.  If the specified channel doesn't exist,
 * a new channel is created.  Client is added to channel by function
 * Add_Client().
 */
GLOBAL bool
Channel_Join( CLIENT *Client, const char *Name )
{
	CHANNEL *chan;

	assert(Client != NULL);
	assert(Name != NULL);

	/* Check that the channel name is valid */
	if (! Channel_IsValidName(Name)) {
		IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
				   Client_ID(Client), Name);
		return false;
	}

	chan = Channel_Search(Name);
	if(chan) {
		/* Check if the client is already in the channel */
		if (Get_Cl2Chan(chan, Client))
			return false;
	} else {
		/* If the specified channel does not exist, the channel
		 * is now created */
		chan = Channel_Create(Name);
		if (!chan)
			return false;
	}

	/* Add user to Channel */
	if (! Add_Client(chan, Client))
		return false;

	return true;
} /* Channel_Join */
开发者ID:husemann,项目名称:ngircd,代码行数:42,代码来源:channel.c


示例8: Synchronize_Lists

/**
 * Synchronize invite, ban, except, and G-Line lists between servers.
 *
 * @param Client New server.
 * @return CONNECTED or DISCONNECTED.
 */
static bool
Synchronize_Lists(CLIENT * Client)
{
	CHANNEL *c;
	struct list_head *head;
	struct list_elem *elem;
	time_t t;

	assert(Client != NULL);

	/* g-lines */
	head = Class_GetList(CLASS_GLINE);
	elem = Lists_GetFirst(head);
	while (elem) {
		t = Lists_GetValidity(elem) - time(NULL);
		if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s",
					Lists_GetMask(elem),
					t > 0 ? (long)t : 0,
					Lists_GetReason(elem)))
			return DISCONNECTED;
		elem = Lists_GetNext(elem);
	}

	c = Channel_First();
	while (c) {
		if (!Send_List(Client, c, Channel_GetListExcepts(c), 'e'))
			return DISCONNECTED;
		if (!Send_List(Client, c, Channel_GetListBans(c), 'b'))
			return DISCONNECTED;
		if (!Send_List(Client, c, Channel_GetListInvites(c), 'I'))
			return DISCONNECTED;
		c = Channel_Next(c);
	}
	return CONNECTED;
}
开发者ID:LucentW,项目名称:ngircd,代码行数:41,代码来源:numeric.c


示例9: Announce_Server

/**
 * Announce new server in the network
 * @param Client New server
 * @param Server Existing server in the network
 */
static bool
Announce_Server(CLIENT * Client, CLIENT * Server)
{
	CLIENT *c;

	if (Client_Conn(Server) > NONE) {
		/* Announce the new server to the one already registered
		 * which is directly connected to the local server */
		if (!IRC_WriteStrClient
		    (Server, "SERVER %s %d %d :%s", Client_ID(Client),
		     Client_Hops(Client) + 1, Client_MyToken(Client),
		     Client_Info(Client)))
			return DISCONNECTED;
	}

	if (Client_Hops(Server) == 1)
		c = Client_ThisServer();
	else
		c = Client_TopServer(Server);

	/* Inform new server about the one already registered in the network */
	return IRC_WriteStrClientPrefix(Client, c, "SERVER %s %d %d :%s",
		Client_ID(Server), Client_Hops(Server) + 1,
		Client_MyToken(Server), Client_Info(Server));
} /* Announce_Server */
开发者ID:LucentW,项目名称:ngircd,代码行数:30,代码来源:numeric.c


示例10: Handle_CAP_LIST

/**
 * Handler for the "CAP LIST" command.
 *
 * @param Client The client from which this command has been received.
 * @param Arg Command argument or NULL.
 * @returns CONNECTED or DISCONNECTED.
 */
bool
Handle_CAP_LIST(CLIENT *Client, UNUSED char *Arg)
{
    assert(Client != NULL);

    return IRC_WriteStrClient(Client, "CAP %s LIST :%s", Client_ID(Client),
                              Get_CAP_String(Client_Cap(Client)));
}
开发者ID:husemann,项目名称:ngircd,代码行数:15,代码来源:irc-cap.c


示例11: Add_To_List

/**
 * Add entries to channel invite, ban and exception lists.
 *
 * @param what Can be 'I' for invite, 'b' for ban, and 'e' for exception list.
 * @param Prefix The originator of the command.
 * @param Client The sender of the command.
 * @param Channel The channel of which the list should be modified.
 * @param Pattern The pattern to add to the list.
 * @return CONNECTED or DISCONNECTED.
 */
static bool
Add_To_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
	    const char *Pattern)
{
	char mask[MASK_LEN];
	struct list_head *list = NULL;
	long int current_count;

	assert(Client != NULL);
	assert(Channel != NULL);
	assert(Pattern != NULL);
	assert(what == 'I' || what == 'b' || what == 'e');

	Lists_MakeMask(Pattern, mask, sizeof(mask));
	current_count = Lists_Count(Channel_GetListInvites(Channel))
			+ Lists_Count(Channel_GetListExcepts(Channel))
			+ Lists_Count(Channel_GetListBans(Channel));

	switch(what) {
		case 'I':
			list = Channel_GetListInvites(Channel);
			break;
		case 'b':
			list = Channel_GetListBans(Channel);
			break;
		case 'e':
			list = Channel_GetListExcepts(Channel);
			break;
	}

	if (Lists_CheckDupeMask(list, mask))
		return CONNECTED;
	if (Client_Type(Client) == CLIENT_USER &&
	    current_count >= MAX_HNDL_CHANNEL_LISTS)
		return IRC_WriteStrClient(Client, ERR_LISTFULL_MSG,
					  Client_ID(Client),
					  Channel_Name(Channel), mask,
					  MAX_HNDL_CHANNEL_LISTS);

	switch (what) {
		case 'I':
			if (!Channel_AddInvite(Channel, mask, false))
				return CONNECTED;
			break;
		case 'b':
			if (!Channel_AddBan(Channel, mask))
				return CONNECTED;
			break;
		case 'e':
			if (!Channel_AddExcept(Channel, mask))
				return CONNECTED;
			break;
	}
	return Send_ListChange(true, what, Prefix, Client, Channel, mask);
}
开发者ID:cofyc,项目名称:ngircd,代码行数:65,代码来源:irc-mode.c


示例12: Handle_CAP_LS

/**
 * Handler for the "CAP LS" command.
 *
 * @param Client The client from which this command has been received.
 * @param Arg Command argument or NULL.
 * @returns CONNECTED or DISCONNECTED.
 */
bool
Handle_CAP_LS(CLIENT *Client, UNUSED char *Arg)
{
    assert(Client != NULL);

    Set_CAP_Negotiation(Client);

    return IRC_WriteStrClient(Client,
                              "CAP %s LS :multi-prefix",
                              Client_ID(Client));
}
开发者ID:husemann,项目名称:ngircd,代码行数:18,代码来源:irc-cap.c


示例13: Handle_CAP_REQ

/**
 * Handler for the "CAP REQ" command.
 *
 * @param Client The client from which this command has been received.
 * @param Arg Command argument.
 * @returns CONNECTED or DISCONNECTED.
 */
bool
Handle_CAP_REQ(CLIENT *Client, char *Arg)
{
    int new_cap;

    assert(Client != NULL);
    assert(Arg != NULL);

    Set_CAP_Negotiation(Client);

    new_cap = Parse_CAP(Client_Cap(Client), Arg);

    if (new_cap < 0)
        return IRC_WriteStrClient(Client, "CAP %s NAK :%s",
                                  Client_ID(Client), Arg);

    Client_CapSet(Client, new_cap);
    return IRC_WriteStrClient(Client, "CAP %s ACK :%s",
                              Client_ID(Client), Arg);
}
开发者ID:husemann,项目名称:ngircd,代码行数:27,代码来源:irc-cap.c


示例14: IRC_WEBIRC

/**
 * Handler for the IRC "WEBIRC" command.
 *
 * See doc/Protocol.txt, section II.4:
 * "Update webchat/proxy client information".
 *
 * @param Client	The client from which this command has been received.
 * @param Req		Request structure with prefix and all parameters.
 * @returns		CONNECTED or DISCONNECTED.
 */
GLOBAL bool
IRC_WEBIRC(CLIENT *Client, REQUEST *Req)
{
	/* Exactly 4 parameters are requited */
	if (Req->argc != 4)
		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
					  Client_ID(Client), Req->command);

	if (!Conf_WebircPwd[0] || strcmp(Req->argv[0], Conf_WebircPwd) != 0)
		return IRC_WriteStrClient(Client, ERR_PASSWDMISMATCH_MSG,
					  Client_ID(Client));

	LogDebug("Connection %d: got valid WEBIRC command: user=%s, host=%s, ip=%s",
		 Client_Conn(Client), Req->argv[1], Req->argv[2], Req->argv[3]);

	Client_SetUser(Client, Req->argv[1], true);
	Client_SetOrigUser(Client, Req->argv[1]);
	Client_SetHostname(Client, Req->argv[2]);
	return CONNECTED;
} /* IRC_WEBIRC */
开发者ID:husemann,项目名称:ngircd,代码行数:30,代码来源:irc-login.c


示例15: Channel_Write

GLOBAL bool
Channel_Write(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Command,
	      bool SendErrors, const char *Text)
{
	if (!Can_Send_To_Channel(Chan, From)) {
		if (! SendErrors)
			return CONNECTED;	/* no error, see RFC 2812 */
		if (strchr(Channel_Modes(Chan), 'M'))
			return IRC_WriteStrClient(From, ERR_NEEDREGGEDNICK_MSG,
						  Client_ID(From), Channel_Name(Chan));
		else
			return IRC_WriteStrClient(From, ERR_CANNOTSENDTOCHAN_MSG,
					  Client_ID(From), Channel_Name(Chan));
	}

	if (Client_Conn(From) > NONE)
		Conn_UpdateIdle(Client_Conn(From));

	return IRC_WriteStrChannelPrefix(Client, Chan, From, true,
			"%s %s :%s", Command, Channel_Name(Chan), Text);
}
开发者ID:husemann,项目名称:ngircd,代码行数:21,代码来源:channel.c


示例16: IRC_HELP

GLOBAL bool
IRC_HELP( CLIENT *Client, REQUEST *Req )
{
	COMMAND *cmd;

	assert( Client != NULL );
	assert( Req != NULL );

	/* Bad number of arguments? */
	if( Req->argc > 0 ) return IRC_WriteStrClient( Client, ERR_NORECIPIENT_MSG, Client_ID( Client ), Req->command );

	cmd = Parse_GetCommandStruct( );
	while( cmd->name )
	{
		if( ! IRC_WriteStrClient( Client, "NOTICE %s :%s", Client_ID( Client ), cmd->name )) return DISCONNECTED;
		cmd++;
	}
	
	IRC_SetPenalty( Client, 2 );
	return CONNECTED;
} /* IRC_HELP */
开发者ID:mguindin,项目名称:ngircd,代码行数:21,代码来源:irc.c


示例17: ShowChannelList

static bool
ShowChannelList(struct list_head *head, CLIENT *Client, CHANNEL *Channel,
		char *msg, char *msg_end)
{
	struct list_elem *e;

	assert (Client != NULL);
	assert (Channel != NULL);

	e = Lists_GetFirst(head);
	while (e) {
		if (!IRC_WriteStrClient(Client, msg, Client_ID(Client),
					Channel_Name(Channel),
					Lists_GetMask(e)))
			return DISCONNECTED;
		e = Lists_GetNext(e);
	}

	return IRC_WriteStrClient(Client, msg_end, Client_ID(Client),
				  Channel_Name(Channel));
}
开发者ID:asterIRC,项目名称:ngIRCd-xpfx,代码行数:21,代码来源:channel.c


示例18: IRC_AWAY

/**
 * Handler for the IRC "AWAY" command.
 *
 * @param Client The client from which this command has been received.
 * @param Req Request structure with prefix and all parameters.
 * @return CONNECTED or DISCONNECTED.
 */
GLOBAL bool
IRC_AWAY( CLIENT *Client, REQUEST *Req )
{
	assert (Client != NULL);
	assert (Req != NULL);

	if (Req->argc == 1 && Req->argv[0][0]) {
		Client_SetAway(Client, Req->argv[0]);
		Client_ModeAdd(Client, 'a');
		IRC_WriteStrServersPrefix(Client, Client, "MODE %s :+a",
					  Client_ID( Client));
		return IRC_WriteStrClient(Client, RPL_NOWAWAY_MSG,
					  Client_ID( Client));
	} else {
		Client_ModeDel(Client, 'a');
		IRC_WriteStrServersPrefix(Client, Client, "MODE %s :-a",
					  Client_ID( Client));
		return IRC_WriteStrClient(Client, RPL_UNAWAY_MSG,
					  Client_ID( Client));
	}
} /* IRC_AWAY */
开发者ID:LucentW,项目名称:ngircd,代码行数:28,代码来源:irc-mode.c


示例19: try_kick

static bool
try_kick(CLIENT *peer, CLIENT* from, const char *nick, const char *channel,
	 const char *reason)
{
	CLIENT *target = Client_Search(nick);

	if (!target)
		return IRC_WriteStrClient(from, ERR_NOSUCHNICK_MSG, Client_ID(from), nick);

	Channel_Kick(peer, target, from, channel, reason);
	return true;
}
开发者ID:cofyc,项目名称:ngircd,代码行数:12,代码来源:irc-op.c


示例20: IRC_MODE

/**
 * Handler for the IRC "MODE" command.
 *
 * See RFC 2812 section 3.1.5 ("user mode message") and section 3.2.3
 * ("channel mode message"), and RFC 2811 section 4 ("channel modes").
 *
 * @param Client	The client from which this command has been received.
 * @param Req		Request structure with prefix and all parameters.
 * @returns		CONNECTED or DISCONNECTED.
 */
GLOBAL bool
IRC_MODE( CLIENT *Client, REQUEST *Req )
{
	CLIENT *cl, *origin;
	CHANNEL *chan;

	assert(Client != NULL);
	assert(Req != NULL);

	/* No parameters? */
	if (Req->argc < 1)
		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
					  Client_ID(Client), Req->command);

	/* Origin for answers */
	if (Client_Type(Client) == CLIENT_SERVER) {
		origin = Client_Search(Req->prefix);
		if (!origin)
			return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
						  Client_ID(Client),
						  Req->prefix);
	} else
		origin = Client;

	/* Channel or user mode? */
	cl = NULL; chan = NULL;
	if (Client_IsValidNick(Req->argv[0]))
		cl = Client_Search(Req->argv[0]);
	if (Channel_IsValidName(Req->argv[0]))
		chan = Channel_Search(Req->argv[0]);

	if (cl)
		return Client_Mode(Client, Req, origin, cl);
	if (chan)
		return Channel_Mode(Client, Req, origin, chan);

	/* No target found! */
	return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
			Client_ID(Client), Req->argv[0]);
} /* IRC_MODE */
开发者ID:cofyc,项目名称:ngircd,代码行数:50,代码来源:irc-mode.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IRDA_DEBUG函数代码示例发布时间:2022-05-30
下一篇:
C++ IPin_Release函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap