aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitlbee.c11
-rw-r--r--conf.c13
-rw-r--r--conf.h1
-rwxr-xr-xconfigure5
-rw-r--r--irc_commands.c10
-rw-r--r--protocols/msn/msn.c4
-rw-r--r--protocols/msn/sb.c5
-rw-r--r--protocols/oscar/service.c2
-rw-r--r--root_commands.c3
9 files changed, 43 insertions, 11 deletions
diff --git a/bitlbee.c b/bitlbee.c
index 2f757f53..ddd8d2ea 100644
--- a/bitlbee.c
+++ b/bitlbee.c
@@ -44,6 +44,7 @@ int bitlbee_daemon_init()
#endif
int i;
GIOChannel *ch;
+ FILE *fp;
log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );
log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );
@@ -117,6 +118,16 @@ int bitlbee_daemon_init()
if( global.conf->runmode == RUNMODE_FORKDAEMON )
ipc_master_load_state();
+ if( ( fp = fopen( global.conf->pidfile, "w" ) ) )
+ {
+ fprintf( fp, "%d\n", (int) getpid() );
+ fclose( fp );
+ }
+ else
+ {
+ log_message( LOGLVL_WARNING, "Warning: Couldn't write PID to `%s'", global.conf->pidfile );
+ }
+
return( 0 );
}
diff --git a/conf.c b/conf.c
index d90816d5..dd99d741 100644
--- a/conf.c
+++ b/conf.c
@@ -61,6 +61,7 @@ conf_t *conf_load( int argc, char *argv[] )
conf->oper_pass = NULL;
conf->configdir = g_strdup( CONFIG );
conf->plugindir = g_strdup( PLUGINDIR );
+ conf->pidfile = g_strdup( "/var/run/bitlbee.pid" );
conf->motdfile = g_strdup( ETCDIR "/motd.txt" );
conf->ping_interval = 180;
conf->ping_timeout = 300;
@@ -77,7 +78,7 @@ conf_t *conf_load( int argc, char *argv[] )
fprintf( stderr, "Warning: Unable to read configuration file `%s'.\n", CONF_FILE );
}
- while( argc > 0 && ( opt = getopt( argc, argv, "i:p:nvIDFc:d:hR:" ) ) >= 0 )
+ while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:" ) ) >= 0 )
/* ^^^^ Just to make sure we skip this step from the REHASH handler. */
{
if( opt == 'i' )
@@ -93,6 +94,11 @@ conf_t *conf_load( int argc, char *argv[] )
}
conf->port = i;
}
+ else if( opt == 'p' )
+ {
+ g_free( conf->pidfile );
+ conf->pidfile = g_strdup( optarg );
+ }
else if( opt == 'n' )
conf->nofork = 1;
else if( opt == 'v' )
@@ -184,6 +190,11 @@ static int conf_loadini( conf_t *conf, char *file )
else
conf->runmode = RUNMODE_INETD;
}
+ else if( g_strcasecmp( ini->key, "pidfile" ) == 0 )
+ {
+ g_free( conf->pidfile );
+ conf->pidfile = g_strdup( ini->value );
+ }
else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 )
{
conf->iface = g_strdup( ini->value );
diff --git a/conf.h b/conf.h
index d6460901..e852dbef 100644
--- a/conf.h
+++ b/conf.h
@@ -42,6 +42,7 @@ typedef struct conf
char *hostname;
char *configdir;
char *plugindir;
+ char *pidfile;
char *motdfile;
char *primary_storage;
char **migrate_storage;
diff --git a/configure b/configure
index 7900967b..2731d5b1 100755
--- a/configure
+++ b/configure
@@ -13,6 +13,7 @@ etcdir='$prefix/etc/bitlbee/'
mandir='$prefix/share/man/'
datadir='$prefix/share/bitlbee/'
config='/var/lib/bitlbee/'
+pidfile='/var/run/bitlbee.pid'
plugindir='$prefix/lib/bitlbee'
msn=1
@@ -45,6 +46,7 @@ Option Description Default
--mandir=... $mandir
--datadir=... $datadir
--plugindir=... $plugindir
+--pidfile=... $pidfile
--config=... $config
--msn=0/1 Disable/enable MSN part $msn
@@ -73,6 +75,7 @@ mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
+pidfile=`eval echo "$pidfile/" | sed 's/\/\{1,\}/\//g'`
cat<<EOF>Makefile.settings
## BitlBee settings, generated by configure
@@ -82,6 +85,7 @@ ETCDIR=$etcdir
MANDIR=$mandir
DATADIR=$datadir
PLUGINDIR=$plugindir
+PIDFILE=$pidfile
CONFIG=$config
ARCH=$arch
@@ -103,6 +107,7 @@ cat<<EOF>config.h
#define ETCDIR "$etcdir"
#define VARDIR "$datadir"
#define PLUGINDIR "$plugindir"
+#define PIDFILE "$pidfile"
#define ARCH "$arch"
#define CPU "$cpu"
EOF
diff --git a/irc_commands.c b/irc_commands.c
index bbeb3db9..f2c7a645 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -414,8 +414,8 @@ static void irc_cmd_topic( irc_t *irc, char **cmd )
static void irc_cmd_away( irc_t *irc, char **cmd )
{
user_t *u = user_find( irc, irc->nick );
- GSList *c = get_connections();
char *away = cmd[1];
+ account_t *a;
if( !u ) return;
@@ -442,12 +442,12 @@ static void irc_cmd_away( irc_t *irc, char **cmd )
irc_reply( irc, 305, ":Welcome back" );
}
- while( c )
+ for( a = irc->accounts; a; a = a->next )
{
- if( ((struct gaim_connection *)c->data)->flags & OPT_LOGGED_IN )
- proto_away( c->data, u->away );
+ struct gaim_connection *gc = a->gc;
- c = c->next;
+ if( gc && gc->flags & OPT_LOGGED_IN )
+ proto_away( gc, u->away );
}
}
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index b03c898e..3c7064f8 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -83,13 +83,13 @@ static void msn_close( struct gaim_connection *gc )
for( l = md->msgq; l; l = l->next )
{
m = l->data;
+
+ serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
g_free( m->who );
g_free( m->text );
g_free( m );
}
g_slist_free( md->msgq );
-
- serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message(s), you'll have to resend them." );
}
for( l = gc->permit; l; l = l->next )
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c
index 9e7ef841..deaceba1 100644
--- a/protocols/msn/sb.c
+++ b/protocols/msn/sb.c
@@ -212,13 +212,16 @@ void msn_sb_destroy( struct msn_switchboard *sb )
for( l = sb->msgq; l; l = l->next )
{
m = l->data;
+
g_free( m->who );
g_free( m->text );
g_free( m );
}
g_slist_free( sb->msgq );
- serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with unsent message(s), you'll have to resend them." );
+ serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with "
+ "unsent message to %s, you'll have to resend it.",
+ m->who ? m->who : "(unknown)" );
}
if( sb->chat )
diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c
index 875a2eb0..573e1983 100644
--- a/protocols/oscar/service.c
+++ b/protocols/oscar/service.c
@@ -736,8 +736,6 @@ int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, guint32 status)
tlvlen = aim_addtlvtochain32(&tl, 0x0006, data);
- printf("%d\n", tlvlen);
-
if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8)))
return -ENOMEM;
diff --git a/root_commands.c b/root_commands.c
index 426cf6e8..f69442d3 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -600,6 +600,9 @@ static void cmd_set( irc_t *irc, char **cmd )
if( cmd[1] && cmd[2] )
{
set_setstr( irc, cmd[1], cmd[2] );
+
+ if( ( strcmp( cmd[2], "=" ) ) == 0 && cmd[3] )
+ irc_usermsg( irc, "Warning: Correct syntax: \002set <variable> <value>\002 (without =)" );
}
if( cmd[1] ) /* else 'forgotten' on purpose.. Must show new value after changing */
{