aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-06-03 21:51:16 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2006-06-03 21:51:16 +0200
commitfb62f81f947c74e274b05e32d2e88e3a4d7e2613 (patch)
tree66cffb74a057bbb2347e5842ec6694e0bd71672f
parentc38e9656987d0b56f233353d2d0fa63c68dcf365 (diff)
Implemented netsplits for "account off".
-rw-r--r--irc.c26
-rw-r--r--protocols/nogaim.c3
-rw-r--r--protocols/nogaim.h6
3 files changed, 30 insertions, 5 deletions
diff --git a/irc.c b/irc.c
index db9f7aad..3d3baca6 100644
--- a/irc.c
+++ b/irc.c
@@ -898,9 +898,31 @@ void irc_kick( irc_t *irc, user_t *u, char *channel, user_t *kicker )
void irc_kill( irc_t *irc, user_t *u )
{
- char *nick;
+ char *nick, *s;
+ char reason[64];
+
+ if( u->gc && u->gc->flags & OPT_LOGGING_OUT )
+ {
+ if( u->gc->user->proto_opt[0][0] )
+ g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
+ u->gc->user->proto_opt[0] );
+ else if( ( s = strchr( u->gc->username, '@' ) ) )
+ g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
+ s + 1 );
+ else
+ g_snprintf( reason, sizeof( reason ), "%s %s.%s", irc->myhost,
+ u->gc->prpl->name, irc->myhost );
+
+ /* proto_opt might contain garbage after the : */
+ if( ( s = strchr( reason, ':' ) ) )
+ *s = 0;
+ }
+ else
+ {
+ strcpy( reason, "Leaving..." );
+ }
- irc_write( irc, ":%s!%s@%s QUIT :%s", u->nick, u->user, u->host, "Leaving..." );
+ irc_write( irc, ":%s!%s@%s QUIT :%s", u->nick, u->user, u->host, reason );
nick = g_strdup( u->nick );
nick_lc( nick );
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 04d48236..f95ddd8a 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -294,7 +294,8 @@ void signoff( struct gaim_connection *gc )
account_t *a;
serv_got_crap( gc, "Signing off.." );
-
+ gc->flags |= OPT_LOGGING_OUT;
+
gaim_input_remove( gc->keepalive );
gc->keepalive = 0;
gc->prpl->close( gc );
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index 8744054a..b143440a 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -53,10 +53,12 @@
#define WEBSITE "http://www.bitlbee.org/"
#define IM_FLAG_AWAY 0x0020
-#define OPT_CONN_HTML 0x00000001
-#define OPT_LOGGED_IN 0x00010000
#define GAIM_AWAY_CUSTOM "Custom"
+#define OPT_CONN_HTML 0x00000001
+#define OPT_LOGGED_IN 0x00010000
+#define OPT_LOGGING_OUT 0x00020000
+
/* ok. now the fun begins. first we create a connection structure */
struct gaim_connection
{