<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.darenet.org/skins/common/feed.css?12"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>ircu api - send - Revision history</title>
		<link>http://wiki.darenet.org/index.php?title=ircu_api_-_send&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.1</generator>
		<lastBuildDate>Wed, 20 May 2026 06:12:28 GMT</lastBuildDate>
		<item>
			<title>Secretagent:&amp;#32;New page: &lt;pre&gt;The send functions are perhaps the most important API in all of ircd; without them, communications would not be possible.  Most of these functions are pretty much stand-alone, althoug...</title>
			<link>http://wiki.darenet.org/index.php?title=ircu_api_-_send&amp;diff=2279&amp;oldid=prev</link>
			<description>&lt;p&gt;New page: &amp;lt;pre&amp;gt;The send functions are perhaps the most important API in all of ircd; without them, communications would not be possible.  Most of these functions are pretty much stand-alone, althoug...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;The send functions are perhaps the most important API in all of ircd;&lt;br /&gt;
without them, communications would not be possible.  Most of these&lt;br /&gt;
functions are pretty much stand-alone, although one or two are&lt;br /&gt;
intended for use in conjunction with the MsgQ interface.  The send&lt;br /&gt;
functions use the MsgQ interface internally, but for the most part,&lt;br /&gt;
this fact is hidden from the caller.&lt;br /&gt;
&lt;br /&gt;
Command tokenization provides the greatest complication.  The&lt;br /&gt;
functions do use ircd_snprintf() internally, so the use of numerics&lt;br /&gt;
doesn't increase that complication.  The tokenization issue is dealt&lt;br /&gt;
with by making each function accept two char* pointers, _cmd_ and&lt;br /&gt;
_tok_, in that order, and then defining a CMD_* macro in msg.h that&lt;br /&gt;
contains the message string and the token string in that order.  When&lt;br /&gt;
one of these functions is called, it determines whether the&lt;br /&gt;
destination will be a server or a user, then selects the correct one,&lt;br /&gt;
either _cmd_ or _tok_, for that message.&lt;br /&gt;
&lt;br /&gt;
The MsgQ interface provides the concept of a priority queue; messages&lt;br /&gt;
which must be sent as soon as possible, regardless of what other&lt;br /&gt;
messages may already be in the queue.  The sendcmdto_prio_one() and&lt;br /&gt;
sendcmdto_flag_butone() functions make use of this priority queue.&lt;br /&gt;
The function send_buffer() also takes a _prio_ argument that should be&lt;br /&gt;
non-zero if the message passed to it should be placed in the priority&lt;br /&gt;
queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define SKIP_DEAF	0x01	/* skip users that are +d */&lt;br /&gt;
&lt;br /&gt;
This flag may be passed to sendcmdto_channel_butone() to cause a&lt;br /&gt;
message passed by that function to skip users that are +d.  See the&lt;br /&gt;
documentation for sendcmdto_channel_butone() for more information.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define SKIP_BURST	0x02	/* skip users that are bursting */&lt;br /&gt;
&lt;br /&gt;
This is another flag that may be passed to&lt;br /&gt;
sendcmdto_channel_butone().  Its purpose is to cause the server to not&lt;br /&gt;
send the message across a link that is still in the &amp;quot;burst&amp;quot; stage of&lt;br /&gt;
network junction.  See the documentation for&lt;br /&gt;
sendcmdto_channel_butone() for more information.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define SKIP_NONOPS	0x04	/* skip users that aren't chanops */&lt;br /&gt;
&lt;br /&gt;
Some messages may need to be passed only to channel operators.  This&lt;br /&gt;
flag is passed to sendcmdto_channel_butone() when that is the case.&lt;br /&gt;
See the documentation for sendcmdto_channel_butone() for more&lt;br /&gt;
information.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void send_buffer(struct Client* to, struct MsgBuf* buf, int prio);&lt;br /&gt;
&lt;br /&gt;
Some applications may need to build a message piece by piece, directly&lt;br /&gt;
utilizing the MsgQ interface.  The function send_buffer() is used when&lt;br /&gt;
that message has been completed to place the message on a client's&lt;br /&gt;
queue.  See the documentation for the MsgQ interface for more&lt;br /&gt;
information about struct MsgBuf and the _buf_ parameter.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void flush_connections(struct Client* cptr);&lt;br /&gt;
&lt;br /&gt;
This function attempts to send all queued data to a client specified&lt;br /&gt;
by _cptr_.  If _cptr_ is 0, all clients with non-empty send queues&lt;br /&gt;
will have their queues flushed.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void send_queued(struct Client *to);&lt;br /&gt;
&lt;br /&gt;
This function attempts to send all queued data to a client specified&lt;br /&gt;
by _to_.  The _to_ parameter is not permitted to be 0.  This is the&lt;br /&gt;
function called by flush_connections().&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendrawto_one(struct Client *to, const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
Most of the actual send functions in this API send their data with a&lt;br /&gt;
prefix--the numeric of the origin.  This function is used when a&lt;br /&gt;
message should be sent _without_ that prefix.  The caller must specify&lt;br /&gt;
the complete message, including the exact command, with the _pattern_&lt;br /&gt;
argument and the variable argument list following it.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendcmdto_one(struct Client *from, const char *cmd, const char *tok,&lt;br /&gt;
		   struct Client *to, const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
This function is used for sending messages to specific clients.  The&lt;br /&gt;
origin of the message is specified using the _from_ parameter; this&lt;br /&gt;
will be used to formulate the origin.  As mentioned above, _cmd_ and&lt;br /&gt;
_tok_ are used to determine the command and token to be used.  The&lt;br /&gt;
_to_ parameter specifies which client the message should be sent to.&lt;br /&gt;
The origin and command will be formatted and followed by a space; the&lt;br /&gt;
given _pattern_ and the following arguments are passed to&lt;br /&gt;
ircd_snprintf() for formatting.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendcmdto_prio_one(struct Client *from, const char *cmd, const char *tok,&lt;br /&gt;
			struct Client *to, const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
This function is identical to sendcmdto_one() except that messages&lt;br /&gt;
formatted using it will be placed onto the priority queue.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendcmdto_serv_butone(struct Client *from, const char *cmd,&lt;br /&gt;
			   const char *tok, struct Client *one,&lt;br /&gt;
			   const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
This function treats its arguments similar to sendcmdto_one() does.&lt;br /&gt;
Messages passed created with this function are sent to all directly&lt;br /&gt;
linked servers except for the _one_ passed.  If _one_ is 0, the&lt;br /&gt;
message is sent to all linked servers.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendcmdto_common_channels(struct Client *from, const char *cmd,&lt;br /&gt;
			       const char *tok, const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
When a user quits IRC, all of the other users on the channels that the&lt;br /&gt;
user is on must receive a single QUIT message.  This function formats&lt;br /&gt;
the message, under control of _from_ (for the origin prefix), _cmd_&lt;br /&gt;
and _tok_, and _pattern_ and the variable argument list, and sends&lt;br /&gt;
that message to all local users on the same channels as the user&lt;br /&gt;
specified by _from_.  This function does not send any messages across&lt;br /&gt;
server&amp;lt;-&amp;gt;server links.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendcmdto_channel_butserv(struct Client *from, const char *cmd,&lt;br /&gt;
			       const char *tok, struct Channel *to,&lt;br /&gt;
			       const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
This function is used to send a command to every local user on a&lt;br /&gt;
particular channel, specified by _to_.  No messages are sent across&lt;br /&gt;
the server&amp;lt;-&amp;gt;server links.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendcmdto_channel_butone(struct Client *from, const char *cmd,&lt;br /&gt;
			      const char *tok, struct Channel *to,&lt;br /&gt;
			      struct Client *one, unsigned int skip,&lt;br /&gt;
			      const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
This function is used mostly for sending PRIVMSG commands to&lt;br /&gt;
particular channels.  The users that receive the message are under the&lt;br /&gt;
control of the _skip_ parameter, which is a binary OR of the&lt;br /&gt;
SKIP_DEAF, SKIP_BURST, and SKIP_NONOPS flags, depending on what&lt;br /&gt;
channel users should see the message.  This function sends messages&lt;br /&gt;
across both client&amp;lt;-&amp;gt;server and server&amp;lt;-&amp;gt;server links, as needed.  The&lt;br /&gt;
client specified by _one_ will not receive a copy of the message.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendcmdto_flag_butone(struct Client *from, const char *cmd,&lt;br /&gt;
			   const char *tok, struct Client *one,&lt;br /&gt;
			   unsigned int flag, const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
This function is used for sending messages to clients with specific&lt;br /&gt;
user modes set (specified by the _flag_ parameter).  Three flags make&lt;br /&gt;
sense for this function: FLAGS_WALLOP (user mode +w), FLAGS_DEBUG&lt;br /&gt;
(user mode +g), and FLAGS_OPER.  FLAGS_OPER has a special meaning that&lt;br /&gt;
further restricts distribution of the message only to IRC operators.&lt;br /&gt;
For the purposes of this function, no distinction is made between&lt;br /&gt;
global operators and local operators.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendcmdto_match_butone(struct Client *from, const char *cmd,&lt;br /&gt;
			    const char *tok, const char *to,&lt;br /&gt;
			    struct Client *one, unsigned int who,&lt;br /&gt;
			    const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
Certain kinds of global messages may be sent by IRC operators.  This&lt;br /&gt;
function implements those global messages.  The _to_ parameter is used&lt;br /&gt;
to specify a pattern by which to filter users, while _who_ specifies&lt;br /&gt;
whether that pattern is to be applied to the user's server name or to&lt;br /&gt;
the user's host name.  The _who_ parameter may be one of MATCH_SERVER&lt;br /&gt;
or MATCH_HOST; these two macros are defined in s_user.h.  The _one_&lt;br /&gt;
parameter will not receive a copy of the message.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void sendto_opmask_butone(struct Client *one, unsigned int mask,&lt;br /&gt;
			  const char *pattern, ...);&lt;br /&gt;
&lt;br /&gt;
The sendto_opmask_butone() function sends a server notice to all&lt;br /&gt;
subscribing users except for _one_.  The _mask_ parameter is one of&lt;br /&gt;
the SNO_* values defined in client.h and is used for selection of&lt;br /&gt;
subscribing users.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
void vsendto_opmask_butone(struct Client *one, unsigned int mask,&lt;br /&gt;
			   const char *pattern, va_list vl);&lt;br /&gt;
&lt;br /&gt;
The vsendto_opmask_butone() function is identical to the&lt;br /&gt;
sendto_opmask_butone() function except that instead of a variable&lt;br /&gt;
argument list, it takes a va_list, specified by _vl_.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;macro&amp;gt;&lt;br /&gt;
#define SND_EXPLICIT	0x40000000	/* first arg is a pattern to use */&lt;br /&gt;
&lt;br /&gt;
When this flag, defined in ircd_reply.h, is combined with the _reply_&lt;br /&gt;
argument to the send_reply() function, the format string send_reply()&lt;br /&gt;
uses is obtained from the first argument in the variable argument list&lt;br /&gt;
passed to that function, rather than from the table of replies.&lt;br /&gt;
&amp;lt;/macro&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;function&amp;gt;&lt;br /&gt;
int send_reply(struct Client* to, int reply, ...);&lt;br /&gt;
&lt;br /&gt;
The send_reply() function, declared in ircd_reply.h, is used to send&lt;br /&gt;
clients numeric replies.  Unless SND_EXPLICIT is used, the pattern&lt;br /&gt;
will be extracted from a table of replies.&lt;br /&gt;
&amp;lt;/function&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;authors&amp;gt;&lt;br /&gt;
Kev &amp;lt;klmitch@mit.edu&amp;gt;&lt;br /&gt;
&amp;lt;/authors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;changelog&amp;gt;&lt;br /&gt;
[2001-6-15 Kev] Initial documentation for the send functions.&lt;br /&gt;
&amp;lt;/changelog&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:IRCu API|Send]]&lt;/div&gt;</description>
			<pubDate>Fri, 25 Apr 2008 04:07:53 GMT</pubDate>			<dc:creator>Secretagent</dc:creator>			<comments>http://wiki.darenet.org/Talk:ircu_api_-_send</comments>		</item>
	</channel>
</rss>