aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitlbee.c2
-rw-r--r--ipc.c10
-rw-r--r--irc.c10
-rw-r--r--irc.h8
-rw-r--r--irc_commands.c6
-rw-r--r--root_commands.c6
-rw-r--r--storage_text.c4
7 files changed, 23 insertions, 23 deletions
diff --git a/bitlbee.c b/bitlbee.c
index 3aca30c5..8cceca6f 100644
--- a/bitlbee.c
+++ b/bitlbee.c
@@ -235,7 +235,7 @@ gboolean bitlbee_io_current_client_write( GIOChannel *source, GIOCondition condi
irc->sendbuffer = NULL;
irc->w_watch_source_id = 0;
- if( irc->status == USTATUS_SHUTDOWN )
+ if( irc->status & USTATUS_SHUTDOWN )
irc_free( irc );
return( FALSE );
diff --git a/ipc.c b/ipc.c
index 18d3284e..5a23d1f9 100644
--- a/ipc.c
+++ b/ipc.c
@@ -114,7 +114,7 @@ static void ipc_child_cmd_die( irc_t *irc, char **cmd )
static void ipc_child_cmd_wallops( irc_t *irc, char **cmd )
{
- if( irc->status < USTATUS_LOGGED_IN )
+ if( ! irc->status & USTATUS_LOGGED_IN )
return;
if( strchr( irc->umode, 'w' ) )
@@ -123,7 +123,7 @@ static void ipc_child_cmd_wallops( irc_t *irc, char **cmd )
static void ipc_child_cmd_lilo( irc_t *irc, char **cmd )
{
- if( irc->status < USTATUS_LOGGED_IN )
+ if( ! irc->status & USTATUS_LOGGED_IN )
return;
if( strchr( irc->umode, 's' ) )
@@ -132,7 +132,7 @@ static void ipc_child_cmd_lilo( irc_t *irc, char **cmd )
static void ipc_child_cmd_opermsg( irc_t *irc, char **cmd )
{
- if( irc->status < USTATUS_LOGGED_IN )
+ if( ! irc->status & USTATUS_LOGGED_IN )
return;
if( strchr( irc->umode, 'o' ) )
@@ -153,7 +153,7 @@ static void ipc_child_cmd_rehash( irc_t *irc, char **cmd )
static void ipc_child_cmd_kill( irc_t *irc, char **cmd )
{
- if( irc->status < USTATUS_LOGGED_IN )
+ if( ! irc->status & USTATUS_LOGGED_IN )
return;
if( nick_cmp( cmd[1], irc->nick ) != 0 )
@@ -165,7 +165,7 @@ static void ipc_child_cmd_kill( irc_t *irc, char **cmd )
static void ipc_child_cmd_hello( irc_t *irc, char **cmd )
{
- if( irc->status < USTATUS_LOGGED_IN )
+ if( ! irc->status & USTATUS_LOGGED_IN )
ipc_to_master_str( "HELLO\r\n" );
else
ipc_to_master_str( "HELLO %s %s :%s\r\n", irc->host, irc->nick, irc->realname );
diff --git a/irc.c b/irc.c
index 3d3baca6..cd30d1c2 100644
--- a/irc.c
+++ b/irc.c
@@ -178,7 +178,7 @@ void irc_abort( irc_t *irc, int immed, char *format, ... )
irc->nick ? irc->nick : "(NONE)", irc->host, "No reason given" );
}
- irc->status = USTATUS_SHUTDOWN;
+ irc->status |= USTATUS_SHUTDOWN;
if( irc->sendbuffer && !immed )
{
/* We won't read from this socket anymore. Instead, we'll connect a timer
@@ -212,7 +212,7 @@ void irc_free(irc_t * irc)
log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd );
- if( irc->status >= USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) )
+ if( irc->status & USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) )
if( storage_save( irc, TRUE ) != STORAGE_OK )
irc_usermsg( irc, "Error while saving settings!" );
@@ -700,7 +700,7 @@ int irc_check_login( irc_t *irc )
{
if( irc->user && irc->nick )
{
- if( global.conf->authmode == AUTHMODE_CLOSED && irc->status < USTATUS_AUTHORIZED )
+ if( global.conf->authmode == AUTHMODE_CLOSED && ! irc->status & USTATUS_AUTHORIZED )
{
irc_reply( irc, 464, ":This server is password-protected." );
return 0;
@@ -757,7 +757,7 @@ void irc_login( irc_t *irc )
if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON )
ipc_to_master_str( "CLIENT %s %s :%s\r\n", irc->host, irc->nick, irc->realname );
- irc->status = USTATUS_LOGGED_IN;
+ irc->status |= USTATUS_LOGGED_IN;
}
void irc_motd( irc_t *irc )
@@ -1180,7 +1180,7 @@ static gboolean irc_userping( gpointer _irc )
irc_t *irc = _irc;
int rv = 0;
- if( irc->status < USTATUS_LOGGED_IN )
+ if( ! irc->status & USTATUS_LOGGED_IN )
{
if( gettime() > ( irc->last_pong + IRC_LOGIN_TIMEOUT ) )
rv = gettime() - irc->last_pong;
diff --git a/irc.h b/irc.h
index 79faea0b..1dc12849 100644
--- a/irc.h
+++ b/irc.h
@@ -41,10 +41,10 @@
typedef enum
{
USTATUS_OFFLINE = 0,
- USTATUS_AUTHORIZED,
- USTATUS_LOGGED_IN,
- USTATUS_IDENTIFIED,
- USTATUS_SHUTDOWN = -1
+ USTATUS_AUTHORIZED = 1,
+ USTATUS_LOGGED_IN = 2,
+ USTATUS_IDENTIFIED = 4,
+ USTATUS_SHUTDOWN = 8
} irc_status_t;
typedef struct channel
diff --git a/irc_commands.c b/irc_commands.c
index dc59f7ee..519070db 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -31,7 +31,7 @@ static void irc_cmd_pass( irc_t *irc, char **cmd )
{
if( global.conf->auth_pass && strcmp( cmd[1], global.conf->auth_pass ) == 0 )
{
- irc->status = USTATUS_AUTHORIZED;
+ irc->status |= USTATUS_AUTHORIZED;
irc_check_login( irc );
}
else
@@ -609,11 +609,11 @@ void irc_exec( irc_t *irc, char *cmd[] )
/* There should be no typo in the next line: */
for( n_arg = 0; cmd[n_arg]; n_arg ++ ); n_arg --;
- if( irc_commands[i].flags & IRC_CMD_PRE_LOGIN && irc->status >= USTATUS_LOGGED_IN )
+ if( irc_commands[i].flags & IRC_CMD_PRE_LOGIN && irc->status & USTATUS_LOGGED_IN )
{
irc_reply( irc, 462, ":Only allowed before logging in" );
}
- else if( irc_commands[i].flags & IRC_CMD_LOGGED_IN && irc->status < USTATUS_LOGGED_IN )
+ else if( irc_commands[i].flags & IRC_CMD_LOGGED_IN && ! irc->status & USTATUS_LOGGED_IN )
{
irc_reply( irc, 451, ":Register first" );
}
diff --git a/root_commands.c b/root_commands.c
index 0e12e9ab..d8611347 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -162,7 +162,7 @@ static void cmd_register( irc_t *irc, char **cmd )
break;
case STORAGE_OK:
- irc->status = USTATUS_IDENTIFIED;
+ irc->status |= USTATUS_IDENTIFIED;
irc_umode_set( irc, "+R", 1 );
break;
@@ -186,7 +186,7 @@ static void cmd_drop( irc_t *irc, char **cmd )
break;
case STORAGE_OK:
irc_setpass( irc, NULL );
- irc->status = USTATUS_LOGGED_IN;
+ irc->status &= ~USTATUS_IDENTIFIED;
irc_umode_set( irc, "-R", 1 );
irc_usermsg( irc, "Account `%s' removed", irc->nick );
break;
@@ -200,7 +200,7 @@ static void cmd_account( irc_t *irc, char **cmd )
{
account_t *a;
- if( global.conf->authmode == AUTHMODE_REGISTERED && irc->status < USTATUS_IDENTIFIED )
+ if( global.conf->authmode == AUTHMODE_REGISTERED && ! irc->status & USTATUS_IDENTIFIED )
{
irc_usermsg( irc, "This server only accepts registered users" );
return;
diff --git a/storage_text.c b/storage_text.c
index f807cb3e..506c9f03 100644
--- a/storage_text.c
+++ b/storage_text.c
@@ -70,7 +70,7 @@ static storage_status_t text_load ( const char *my_nick, const char* password, i
FILE *fp;
user_t *ru = user_find( irc, ROOT_NICK );
- if( irc->status >= USTATUS_IDENTIFIED )
+ if( irc->status & USTATUS_IDENTIFIED )
return( 1 );
g_snprintf( s, 511, "%s%s%s", global.conf->configdir, my_nick, ".accounts" );
@@ -87,7 +87,7 @@ static storage_status_t text_load ( const char *my_nick, const char* password, i
/* Do this now. If the user runs with AuthMode = Registered, the
account command will not work otherwise. */
- irc->status = USTATUS_IDENTIFIED;
+ irc->status |= USTATUS_IDENTIFIED;
while( fscanf( fp, "%511[^\n]s", s ) > 0 )
{