aboutsummaryrefslogtreecommitdiffstats
path: root/irc.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-06-07 15:36:19 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2006-06-07 15:36:19 +0200
commit85e9644fe03cef7b83f3b3200943364e4eecaf14 (patch)
tree1043b458bbcaac400c19a503aec13eb465ea4f65 /irc.c
parenta312b6bcbc6aa836850d94fc2abc70ceffe275cd (diff)
parent0025b5148725e524dfdc1da57b18fcd2be2608ee (diff)
Merging Jelmer's storage tree (with LDAP support).
Diffstat (limited to 'irc.c')
-rw-r--r--irc.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/irc.c b/irc.c
index 97365f4d..45a1940d 100644
--- a/irc.c
+++ b/irc.c
@@ -904,9 +904,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 );