commit - b187fac244f4e14705f882ba7c43eef0238e2830
commit + 32bf6d4de0d565824be6599342a5f5f770d4f7d5
blob - cf5fc8538a1f3af13ebb582f325cf5327a45ab96
blob + 76e286ef3b6028b2d8ef29b00442ad002817dec2
--- configure.in
+++ configure.in
# -- Initialisation --
AC_PREREQ(2.50)
-AC_INIT(ngircd, 0.12.0-pre1)
+AC_INIT(ngircd, 0.12-dev)
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(1.6)
blob - 35922c2b13838bd3bf20fa25192b8b9628667dde
blob + 32f911a200f6269eed0f51420a8523ea980c0b78
--- src/ngircd/channel.c
+++ src/ngircd/channel.c
} /* Channel_Join */
+/**
+ * Remove client from channel.
+ * This function lets a client lead 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_Part(CLIENT * Client, CLIENT * Origin, const char *Name, const char *Reason)
{
CHANNEL *chan;
- assert( Client != NULL );
- assert( Name != NULL );
- assert( Reason != NULL );
+ assert(Client != NULL);
+ assert(Name != NULL);
+ assert(Reason != NULL);
- chan = Channel_Search( Name );
- if(( ! chan ) || ( ! Get_Cl2Chan( chan, Client )))
- {
- IRC_WriteStrClient( Client, ERR_NOSUCHCHANNEL_MSG, Client_ID( Client ), Name );
+ chan = Channel_Search(Name);
+ if (!chan) {
+ IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
+ Client_ID(Client), Name);
return false;
}
+ if (!Get_Cl2Chan(chan, Client)) {
+ IRC_WriteStrClient(Client, ERR_NOTONCHANNEL_MSG,
+ Client_ID(Client), Name);
+ return false;
+ }
- /* User aus Channel entfernen */
- if( ! Remove_Client( REMOVE_PART, chan, Client, Origin, Reason, true)) return false;
- else return true;
+ if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true))
+ return false;
+ else
+ return true;
} /* Channel_Part */
blob - 55770571f61b68b13d39d60bc89abad0100b1642
blob + c678ceeb3f4160a933c6e845ed427e45c7aff70c
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
} /* IRC_JOIN */
+/**
+ * Handler for the IRC "PART" command.
+ */
GLOBAL bool
-IRC_PART( CLIENT *Client, REQUEST *Req )
+IRC_PART(CLIENT * Client, REQUEST * Req)
{
CLIENT *target;
char *chan;
- assert( Client != NULL );
- assert( Req != NULL );
+ assert(Client != NULL);
+ assert(Req != NULL);
if (Req->argc < 1 || Req->argc > 2)
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
- Client_ID(Client), Req->command);
+ Client_ID(Client), Req->command);
- /* Wer ist der Absender? */
- if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
- else target = Client;
- if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
+ /* Get the sender */
+ if (Client_Type(Client) == CLIENT_SERVER)
+ target = Client_Search(Req->prefix);
+ else
+ target = Client;
+ if (!target)
+ return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ Client_ID(Client), Req->prefix);
- /* Channel-Namen durchgehen */
+ /* Loop over all the given channel names */
chan = strtok(Req->argv[0], ",");
while (chan) {
- Channel_Part(target, Client, chan, Req->argc > 1 ? Req->argv[1] : Client_ID(target));
-
+ Channel_Part(target, Client, chan,
+ Req->argc > 1 ? Req->argv[1] : Client_ID(target));
chan = strtok(NULL, ",");
}
return CONNECTED;