!Channel_UserHasMode(chan, Target, 'q') &&
!Channel_UserHasMode(chan, Target, 'a'))
can_kick = true;
-
- /* Half Op can't kick owner | admin | op */
+
+ /* Half Op can't kick owner | admin | op */
else if (Channel_UserHasMode(chan, Peer, 'h') &&
!Channel_UserHasMode(chan, Target, 'q') &&
!Channel_UserHasMode(chan, Target, 'a') &&
!Channel_UserHasMode(chan, Target, 'o'))
can_kick = true;
-
+
/* IRC operators & IRCd with OperCanMode enabled
- * can kick anyways regardless of privilege */
+ * can kick anyways regardless of privilege */
else if(Client_HasMode(Origin, 'o') && Conf_OperCanMode)
can_kick = true;
switch( Type )
{
case REMOVE_QUIT:
- /* QUIT: other servers have already been notified,
+ /* QUIT: other servers have already been notified,
* see Client_Destroy(); so only inform other clients
* in same channel. */
assert( InformServer == false );
Client_Init( void )
{
struct hostent *h;
-
+
This_Server = New_Client_Struct( );
if( ! This_Server )
{
Client_SetInfo( This_Server, Conf_ServerInfo );
My_Clients = This_Server;
-
+
memset( &My_Whowas, 0, sizeof( My_Whowas ));
} /* Client_Init */
if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, false );
else Client_Destroy( This_Server, "Server going down.", NULL, false );
-
+
cnt = 0;
c = My_Clients;
while(c) {
Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool SendQuit )
{
/* remove a client */
-
+
CLIENT *last, *c;
char msg[COMMAND_LEN];
const char *txt;
{
assert( Client != NULL );
assert( ID != NULL );
-
+
strlcpy( Client->id, ID, sizeof( Client->id ));
if (Conf_CloakUserToNick) {
if(Client->type == CLIENT_USER)
assert(strlen(Client->id) < Conf_MaxNickLength);
#endif
-
+
if( Client->id[0] ) return Client->id;
else return "*";
} /* Client_ID */
? (const char*) array_start(&Conf_Motd) : "");
}
printf(" Network = %s\n", Conf_Network);
- if (!Conf_PAM)
+ if (!Conf_PAM)
printf(" Password = %s\n", Conf_ServerPwd);
printf(" PidFile = %s\n", Conf_PidFile);
printf(" Ports = ");
Conn_First( void )
{
CONN_ID i;
-
+
for( i = 0; i < Pool_Size; i++ )
{
if( My_Connections[i].sock != NONE ) return i;
CONN_ID i = NONE;
assert( Idx > NONE );
-
+
for( i = Idx + 1; i < Pool_Size; i++ )
{
if( My_Connections[i].sock != NONE ) return i;
gnutls_x509_crt_deinit(cert);
return 0;
}
-
+
if (gnutls_x509_crt_import(cert, &cert_list[0],
GNUTLS_X509_FMT_DER) != GNUTLS_E_SUCCESS) {
gnutls_x509_crt_deinit(cert);
#endif /* SSL_SUPPORT */
/* -eof- */
-
-
}
My_Connections[Idx].bytes_out += zipbuf_used;
- My_Connections[Idx].zip.bytes_out += array_bytes(&My_Connections[Idx].zip.wbuf);
+ My_Connections[Idx].zip.bytes_out += array_bytes(&My_Connections[Idx].zip.wbuf);
array_trunc(&My_Connections[Idx].zip.wbuf);
return true;
int unzipbuf_used = 0;
unsigned int z_rdatalen;
unsigned int in_len;
-
+
z_stream *in;
assert( Idx > NONE );
array_bytes(&My_ConnArray));
assert(array_length(&My_ConnArray, sizeof(CONNECTION)) >= (size_t)Pool_Size);
-
+
array_free( &My_Listeners );
for (i = 0; i < Pool_Size; i++)
GLOBAL bool
Conn_WriteStr(CONN_ID Idx, const char *Format, ...)
#else
-GLOBAL bool
+GLOBAL bool
Conn_WriteStr(Idx, Format, va_alist)
CONN_ID Idx;
const char *Format;
* IRC_WriteXXX() functions when the prefix of this server had
* to be added to an already "quite long" command line which
* has been received from a regular IRC client, for example.
- *
+ *
* We are not allowed to send such "oversized" messages to
* other servers and clients, see RFC 2812 2.3 and 2813 3.3
* ("these messages SHALL NOT exceed 512 characters in length,
* @returns Pointer to CLIENT structure.
*/
GLOBAL CLIENT *
-Conn_GetClient( CONN_ID Idx )
+Conn_GetClient( CONN_ID Idx )
{
CONNECTION *c;
/* Don't do any PAM authentication at all if PAM is not
* enabled, instead emulate the behavior of the daemon
* compiled without PAM support. */
- if (strcmp(Conn_Password(conn), Conf_ServerPwd) == 0)
+ if (strcmp(Conn_Password(conn), Conf_ServerPwd) == 0)
return Login_User_PostAuth(Client);
Client_Reject(Client, "Bad server password", false);
return DISCONNECTED;
close(pidfd);
return;
}
-
+
if (write(pidfd, pidbuf, (size_t)len) != (ssize_t)len)
Log(LOG_ERR, "Can't write PID file (%s): %s!", Conf_PidFile,
strerror(errno));
Log(LOG_ERR, "Can't change group ID to %s(%u): %s!",
grp ? grp->gr_name : "?", Conf_GID,
strerror(real_errno));
- if (real_errno != EPERM)
+ if (real_errno != EPERM)
goto out;
}
#ifdef HAVE_SETGROUPS
/**
* Parse a command ("request") received from a client.
- *
+ *
* This function is called after the connection layer received a valid CR+LF
* terminated line of text: we assume that this is a valid IRC command and
* try to do something useful with it :-)
Check_strlcat();
Check_strtok_r();
Check_vsnprintf(2+10, "%s%s", "ab", "1234567890");
-
+
return 0;
}
* original. Also, there is now a builtin-test, just compile with:
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
* and run snprintf for results.
- *
+ *
* Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
- * The PGP code was using unsigned hexadecimal formats.
+ * The PGP code was using unsigned hexadecimal formats.
* Unfortunately, unsigned formats simply didn't work.
*
* Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
int flags;
int cflags;
size_t currlen;
-
+
state = DP_S_DEFAULT;
currlen = flags = cflags = min = 0;
max = -1;
ch = *format++;
-
+
while (state != DP_S_DONE) {
- if (ch == '\0')
+ if (ch == '\0')
state = DP_S_DONE;
switch(state) {
case DP_S_DEFAULT:
- if (ch == '%')
+ if (ch == '%')
state = DP_S_FLAGS;
- else
+ else
dopr_outch (buffer, &currlen, maxlen, ch);
ch = *format++;
break;
if (ch == '.') {
state = DP_S_MAX;
ch = *format++;
- } else {
+ } else {
state = DP_S_MOD;
}
break;
switch (ch) {
case 'd':
case 'i':
- if (cflags == DP_C_SHORT)
+ if (cflags == DP_C_SHORT)
value = va_arg (args, int);
else if (cflags == DP_C_LONG)
value = va_arg (args, long int);
}
}
if (maxlen != 0) {
- if (currlen < maxlen - 1)
+ if (currlen < maxlen - 1)
buffer[currlen] = '\0';
- else if (maxlen > 0)
+ else if (maxlen > 0)
buffer[maxlen - 1] = '\0';
}
-
+
return currlen;
}
for (strln = 0; value[strln]; ++strln); /* strlen */
padlen = min - strln;
- if (padlen < 0)
+ if (padlen < 0)
padlen = 0;
- if (flags & DP_F_MINUS)
+ if (flags & DP_F_MINUS)
padlen = -padlen; /* Left Justify */
-
+
while ((padlen > 0) && (cnt < max)) {
dopr_outch (buffer, currlen, maxlen, ' ');
--padlen;
int spadlen = 0; /* amount to space pad */
int zpadlen = 0; /* amount to zero pad */
int caps = 0;
-
+
if (max < 0)
max = 0;
-
+
uvalue = value;
-
+
if(!(flags & DP_F_UNSIGNED)) {
if( value < 0 ) {
signvalue = '-';
signvalue = ' ';
}
}
-
+
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
do {
zpadlen = MAX(zpadlen, spadlen);
spadlen = 0;
}
- if (flags & DP_F_MINUS)
+ if (flags & DP_F_MINUS)
spadlen = -spadlen; /* Left Justifty */
#ifdef DEBUG_SNPRINTF
}
/* Sign */
- if (signvalue)
+ if (signvalue)
dopr_outch (buffer, currlen, maxlen, signvalue);
/* Zeros */
}
/* Digits */
- while (place > 0)
+ while (place > 0)
dopr_outch (buffer, currlen, maxlen, convert[--place]);
-
+
/* Left Justified spaces */
while (spadlen < 0) {
dopr_outch (buffer, currlen, maxlen, ' ');
if (value < 0)
result = -value;
-
+
return result;
}
POW10(int exp)
{
LDOUBLE result = 1;
-
+
while (exp) {
result *= 10;
exp--;
}
-
+
return result;
}
intpart = (LLONG)value;
value = value - intpart;
if (value >= 0.5) intpart++;
-
+
return intpart;
}
ret = my_modf(x0-l*f, &i2);
(*iptr) = l*f + i2;
return ret;
- }
+ }
(*iptr) = l;
return x - (*iptr);
int iplace = 0;
int fplace = 0;
int padlen = 0; /* amount to pad */
- int zpadlen = 0;
+ int zpadlen = 0;
int caps = 0;
int index;
double intpart;
double fracpart;
double temp;
-
- /*
+
+ /*
* AIX manpage says the default is 0, but Solaris says the default
* is 6, and sprintf on AIX defaults to 6
*/
}
}
- /*
- * Sorry, we only support 16 digits past the decimal because of our
+ /*
+ * Sorry, we only support 16 digits past the decimal because of our
* conversion method
*/
if (max > 16)
my_modf(temp, &intpart);
fracpart = ROUND((POW10(max)) * (ufvalue - intpart));
-
+
if (fracpart >= POW10(max)) {
intpart++;
fracpart -= POW10(max);
if (fplace == 311) fplace--;
}
fconvert[fplace] = 0;
-
+
/* -1 for decimal point, another -1 if we are printing a sign */
- padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
+ padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
zpadlen = max - fplace;
if (zpadlen < 0) zpadlen = 0;
- if (padlen < 0)
+ if (padlen < 0)
padlen = 0;
- if (flags & DP_F_MINUS)
+ if (flags & DP_F_MINUS)
padlen = -padlen; /* Left Justifty */
-
+
if ((flags & DP_F_ZERO) && (padlen > 0)) {
if (signvalue) {
dopr_outch (buffer, currlen, maxlen, signvalue);
dopr_outch (buffer, currlen, maxlen, ' ');
--padlen;
}
- if (signvalue)
+ if (signvalue)
dopr_outch (buffer, currlen, maxlen, signvalue);
-
- while (iplace > 0)
+
+ while (iplace > 0)
dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
#ifdef DEBUG_SNPRINTF
*/
if (max > 0) {
dopr_outch (buffer, currlen, maxlen, '.');
-
- while (fplace > 0)
+
+ while (fplace > 0)
dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
}
-
+
while (zpadlen > 0) {
dopr_outch (buffer, currlen, maxlen, '0');
--zpadlen;
{
size_t ret;
va_list ap;
-
+
va_start(ap, fmt);
ret = vsnprintf(str, count, fmt, ap);
va_end(ap);