#include "portab.h"
-static char UNUSED id[] = "$Id: irc-info.c,v 1.23 2005/01/24 14:17:21 alex Exp $";
+static char UNUSED id[] = "$Id: irc-info.c,v 1.27 2005/03/02 16:35:11 alex Exp $";
#include "imp.h"
#include <assert.h>
ptr = strtok( NULL, " " );
}
}
- if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
+ ngt_TrimLastChr(rpl, ' ');
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
} /* IRC_ISON */
strlcat( rpl, " ", sizeof( rpl ));
}
}
- if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
+ ngt_TrimLastChr( rpl, ' ');
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
} /* IRC_USERHOST */
strncpy( ver + 4, ver + 5, 2 );
strncpy( ver + 6, ver + 8, 3 );
snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver );
- return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, vertxt, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
+ return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, vertxt, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition );
#else
- return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
+ return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition );
#endif
} /* IRC_VERSION */
BOOLEAN ok, only_ops;
CHAR flags[8], *ptr;
CL2CHAN *cl2chan;
- CHANNEL *chan;
+ CHANNEL *chan, *cn;
CLIENT *c;
assert( Client != NULL );
if( ok && (( ! only_ops ) || ( strchr( Client_Modes( c ), 'o' ))))
{
- /* Flags zusammenbasteln */
+ /* Get flags */
strcpy( flags, "H" );
if( strchr( Client_Modes( c ), 'o' )) strlcat( flags, "*", sizeof( flags ));
- /* ausgeben */
+ /* Search suitable channel */
cl2chan = Channel_FirstChannelOf( c );
- if( cl2chan ) ptr = Channel_Name( Channel_GetChannel( cl2chan ));
- else ptr = "*";
+ while( cl2chan )
+ {
+ cn = Channel_GetChannel( cl2chan );
+ if( Channel_IsMemberOf( cn, Client ) ||
+ ! strchr( Channel_Modes( cn ), 's' ))
+ {
+ ptr = Channel_Name( cn );
+ break;
+ }
+ cl2chan = Channel_NextChannelOf( c, cl2chan );
+ }
+ if( ! cl2chan ) ptr = "*";
+
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), ptr, Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
}
}
chan = Channel_GetChannel( cl2chan );
assert( chan != NULL );
+ /* next */
+ cl2chan = Channel_NextChannelOf( c, cl2chan );
+
+ /* Secret channel? */
+ if( strchr( Channel_Modes( chan ), 's' ) && ! Channel_IsMemberOf( chan, Client )) continue;
+
/* Concatenate channel names */
if( str[strlen( str ) - 1] != ':' ) strlcat( str, " ", sizeof( str ));
if( strchr( Channel_UserModes( chan, c ), 'o' )) strlcat( str, "@", sizeof( str ));
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
snprintf( str, sizeof( str ), RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
}
-
- /* next */
- cl2chan = Channel_NextChannelOf( c, cl2chan );
}
if( str[strlen( str ) - 1] != ':')
{
BOOLEAN ok;
CHAR line[127];
FILE *fd;
- UINT line_len;
assert( Client != NULL );
{
if( ! fgets( line, sizeof( line ), fd )) break;
- line_len = strlen( line );
- if( line_len > 0 ) pos--;
- if( line[line_len] == '\n' ) line[line_len] = '\0';
+ ngt_TrimLastChr( line, '\n');
if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
{
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
else is_member = FALSE;
+ /* Secret channel? */
+ if( ! is_member && strchr( Channel_Modes( Chan ), 's' )) return CONNECTED;
+
/* Alle Mitglieder suchen */
snprintf( str, sizeof( str ), RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
cl2chan = Channel_FirstMember( Chan );
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
else is_member = FALSE;
+ /* Secret channel? */
+ if( ! is_member && strchr( Channel_Modes( Chan ), 's' )) return CONNECTED;
+
/* Alle Mitglieder suchen */
cl2chan = Channel_FirstMember( Chan );
while( cl2chan )