Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2004-10-02 03:02:57 UTC
Modified files:
ircd/ircd_relay.c
Log message:
Doxyfy ircd_relay.c.
---------------------- diff included ----------------------
Index: ircu2.10/ircd/ircd_relay.c
diff -u ircu2.10/ircd/ircd_relay.c:1.14 ircu2.10/ircd/ircd_relay.c:1.15
--- ircu2.10/ircd/ircd_relay.c:1.14 Sat Sep 11 10:00:50 2004
+++ ircu2.10/ircd/ircd_relay.c Fri Oct 1 20:02:47 2004
@@ -19,8 +19,29 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/* @file
+ * @brief Helper functions to relay various types of messages.
+ * @version $Id: ircd_relay.c,v 1.15 2004/10/02 03:02:47 entrope Exp $
+ *
+ * There are four basic types of messages, each with four subtypes.
+ *
+ * The basic types are: channel, directed, masked, and private.
+ * Channel messages are (perhaps obviously) sent directly to a
+ * channel. Directed messages are sent to "[EMAIL PROTECTED]", but
+ * only allowed if the server is a services server (to avoid
+ * information leaks for normal clients). Masked messages are sent to
+ * either [EMAIL PROTECTED] or *.server.mask. Private messages are sent to
+ * NICK.
*
- * $Id: ircd_relay.c,v 1.14 2004/09/11 17:00:50 entrope Exp $
+ * The subtypes for each type are: client message, client notice,
+ * server message, and server notice. Client subtypes are sent by a
+ * local user, and server subtypes are given to us by a server.
+ * Notice subtypes correspond to the NOTICE command, and message
+ * subtypes correspond to the PRIVMSG command.
+ *
+ * As a special note, directed messages do not have server subtypes,
+ * since there is no difference in handling them based on origin.
*/
#include "config.h"
@@ -54,6 +75,13 @@
* to be cleaned up a bit. The idea is to factor out the common checks
* but not introduce any IsOper/IsUser/MyUser/IsServer etc. stuff.
*/
+
+/** Relay a local user's message to a channel.
+ * Generates an error if the client cannot send to the channel.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Name of target channel.
+ * @param[in] text %Message to relay.
+ */
void relay_channel_message(struct Client* sptr, const char* name, const char* text)
{
struct Channel* chptr;
@@ -80,6 +108,12 @@
SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
}
+/** Relay a local user's notice to a channel.
+ * Silently exits if the client cannot send to the channel.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Name of target channel.
+ * @param[in] text %Message to relay.
+ */
void relay_channel_notice(struct Client* sptr, const char* name, const char* text)
{
struct Channel* chptr;
@@ -97,12 +131,19 @@
if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
check_target_limit(sptr, chptr, chptr->chname, 0))
- return;
+ return;
sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, cli_from(sptr),
SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
}
+/** Relay a message to a channel.
+ * Generates an error if the client cannot send to the channel,
+ * or if the channel is a local channel
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Name of target channel.
+ * @param[in] text %Message to relay.
+ */
void server_relay_channel_message(struct Client* sptr, const char* name, const char*
text)
{
struct Channel* chptr;
@@ -111,9 +152,6 @@
assert(0 != text);
if (IsLocalChannel(name) || 0 == (chptr = FindChannel(name))) {
- /*
- * XXX - do we need to send this back from a remote server?
- */
send_reply(sptr, ERR_NOSUCHCHANNEL, name);
return;
}
@@ -129,6 +167,13 @@
send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
}
+/** Relay a notice to a channel.
+ * Generates an error if the client cannot send to the channel,
+ * or if the channel is a local channel
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Name of target channel.
+ * @param[in] text %Message to relay.
+ */
void server_relay_channel_notice(struct Client* sptr, const char* name, const char*
text)
{
struct Channel* chptr;
@@ -148,7 +193,15 @@
}
}
-
+/** Relay a directed message.
+ * Generates an error if the named server does not exist, if it is not
+ * a services server, or if \a name names a local user and a hostmask
+ * is specified but does not match.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Target nickname, with optional "%hostname" suffix.
+ * @param[in] server Name of target server.
+ * @param[in] text %Message to relay.
+ */
void relay_directed_message(struct Client* sptr, char* name, char* server, const
char* text)
{
struct Client* acptr;
@@ -210,6 +263,15 @@
sendcmdto_one(sptr, CMD_PRIVATE, acptr, "%s :%s", name, text);
}
+/** Relay a directed notice.
+ * Generates an error if the named server does not exist, if it is not
+ * a services server, or if \a name names a local user and a hostmask
+ * is specified but does not match.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Target nickname, with optional "%hostname" suffix.
+ * @param[in] server Name of target server.
+ * @param[in] text %Message to relay.
+ */
void relay_directed_notice(struct Client* sptr, char* name, char* server, const char*
text)
{
struct Client* acptr;
@@ -250,6 +312,14 @@
sendcmdto_one(sptr, CMD_NOTICE, acptr, "%s :%s", name, text);
}
+/** Relay a private message from a local user.
+ * Returns an error if the user does not exist or sending to him would
+ * exceed the source's free targets. Sends an AWAY status message if
+ * the target is marked as away.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Nickname of target user.
+ * @param[in] text %Message to relay.
+ */
void relay_private_message(struct Client* sptr, const char* name, const char* text)
{
struct Client* acptr;
@@ -281,6 +351,14 @@
sendcmdto_one(sptr, CMD_PRIVATE, acptr, "%C :%s", acptr, text);
}
+/** Relay a private notice from a local user.
+ * Returns an error if the user does not exist or sending to him would
+ * exceed the source's free targets. Sends an AWAY status message if
+ * the target is marked as away.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Nickname of target user.
+ * @param[in] text %Message to relay.
+ */
void relay_private_notice(struct Client* sptr, const char* name, const char* text)
{
struct Client* acptr;
@@ -303,6 +381,12 @@
sendcmdto_one(sptr, CMD_NOTICE, acptr, "%C :%s", acptr, text);
}
+/** Relay a private message that arrived from a server.
+ * Returns an error if the user does not exist.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Nickname of target user.
+ * @param[in] text %Message to relay.
+ */
void server_relay_private_message(struct Client* sptr, const char* name, const char*
text)
{
struct Client* acptr;
@@ -328,6 +412,12 @@
}
+/** Relay a private notice that arrived from a server.
+ * Returns an error if the user does not exist.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] name Nickname of target user.
+ * @param[in] text %Message to relay.
+ */
void server_relay_private_notice(struct Client* sptr, const char* name, const char*
text)
{
struct Client* acptr;
@@ -349,6 +439,13 @@
sendcmdto_one(sptr, CMD_NOTICE, acptr, "%C :%s", acptr, text);
}
+/** Relay a masked message from a local user.
+ * Sends an error response if there is no top-level domain label in \a
+ * mask, or if that TLD contains a wildcard.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] mask Target mask for the message.
+ * @param[in] text %Message to relay.
+ */
void relay_masked_message(struct Client* sptr, const char* mask, const char* text)
{
const char* s;
@@ -384,6 +481,13 @@
"%s :%s", mask, text);
}
+/** Relay a masked notice from a local user.
+ * Sends an error response if there is no top-level domain label in \a
+ * mask, or if that TLD contains a wildcard.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] mask Target mask for the message.
+ * @param[in] text %Message to relay.
+ */
void relay_masked_notice(struct Client* sptr, const char* mask, const char* text)
{
const char* s;
@@ -419,6 +523,11 @@
"%s :%s", mask, text);
}
+/** Relay a masked message that arrived from a server.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] mask Target mask for the message.
+ * @param[in] text %Message to relay.
+ */
void server_relay_masked_message(struct Client* sptr, const char* mask, const char*
text)
{
const char* s = mask;
@@ -437,6 +546,11 @@
"%s :%s", mask, text);
}
+/** Relay a masked notice that arrived from a server.
+ * @param[in] sptr Client that originated the message.
+ * @param[in] mask Target mask for the message.
+ * @param[in] text %Message to relay.
+ */
void server_relay_masked_notice(struct Client* sptr, const char* mask, const char*
text)
{
const char* s = mask;
----------------------- End of diff -----------------------