Commit Diff
Diff:
e37080400b6d8a80828c986e90991fcb598d5399
477f2fd9e719d757ff3d6f3515f845c37e13e354
Commit:
477f2fd9e719d757ff3d6f3515f845c37e13e354
Tree:
32e1ea7054a766fc14980ad613ff2a0fff9a1865
Author:
Alexander Barton <alex@barton.de>
Committer:
Alexander Barton <alex@barton.de>
Date:
Tue Jul 22 11:07:57 2008 UTC
Message:
Channel_Join(): Code cleanup.
blob - 937abecc1eb056bd5c32189f2a41312b125f5553
blob + 587668105ff36340cb884b97ae3a28793e42d1c7
--- src/ngircd/channel.c
+++ src/ngircd/channel.c
@@ -183,30 +183,34 @@ Channel_Join( CLIENT *Client, char *Name )
{
CHANNEL *chan;
- assert( Client != NULL );
- assert( Name != NULL );
+ 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 );
+ if (! Channel_IsValidName(Name)) {
+ IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
+ Client_ID(Client), Name);
return false;
}
- chan = Channel_Search( Name );
- if( chan ) {
+ chan = Channel_Search(Name);
+ if(chan) {
/* Check if the client is already in the channel */
- if( Get_Cl2Chan( chan, Client )) return false;
+ 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;
}
- else
- {
- /* If the specified channel doesn't exist, the channel is created */
- chan = Channel_Create( Name );
- if (!chan) return false;
- }
/* Add user to Channel */
- if( ! Add_Client( chan, Client )) return false;
- else return true;
+ if (! Add_Client(chan, Client))
+ return false;
+
+ return true;
} /* Channel_Join */
IRCNow