#include "portab.h"
-static char UNUSED id[] = "$Id: irc-mode.c,v 1.41 2005/04/27 07:38:00 alex Exp $";
+static char UNUSED id[] = "$Id: irc-mode.c,v 1.46 2006/08/12 11:56:24 fw Exp $";
#include "imp.h"
#include <assert.h>
#include "irc-mode.h"
-LOCAL bool Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ));
-LOCAL bool Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel ));
+static bool Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ));
+static bool Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel ));
-LOCAL bool Add_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
-LOCAL bool Add_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
+static bool Add_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
+static bool Add_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
-LOCAL bool Del_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
-LOCAL bool Del_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
+static bool Del_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
+static bool Del_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
-LOCAL bool Send_ListChange PARAMS(( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Mask ));
+static bool Send_ListChange PARAMS(( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Mask ));
GLOBAL bool
if( ! origin ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
}
else origin = Client;
-
+
/* Channel or user mode? */
- cl = 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] );
+ 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 );
+ 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] );
+ return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ Client_ID(Client), Req->argv[0]);
} /* IRC_MODE */
-LOCAL bool
+static bool
Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
{
/* Handle client mode requests */
if( Client_Type( Client ) == CLIENT_SERVER )
{
x[0] = 'a';
- Client_SetAway( Client, DEFAULT_AWAY_MSG );
+ Client_SetAway( Origin, DEFAULT_AWAY_MSG );
}
else ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
break;
} /* Client_Mode */
-LOCAL bool
+static bool
Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
{
/* Handle channel and channel-user modes */
/* The sender is a member: generate extended reply */
strlcpy( the_modes, Channel_Modes( Channel ), sizeof( the_modes ));
mode_ptr = the_modes;
- strcpy( the_args, "" );
+ the_args[0] = '\0';
while( *mode_ptr )
{
switch( *mode_ptr )
} /* IRC_AWAY */
-LOCAL bool
+static bool
Add_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
{
char *mask;
} /* Add_Invite */
-LOCAL bool
+static bool
Add_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
{
char *mask;
} /* Add_Ban */
-LOCAL bool
+static bool
Del_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
{
char *mask;
} /* Del_Invite */
-LOCAL bool
+static bool
Del_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
{
char *mask;
} /* Del_Ban */
-LOCAL bool
+static bool
Send_ListChange( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Mask )
{
/* Bestaetigung an Client schicken & andere Server sowie Channel-User informieren */