aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-05-08 13:13:23 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-05-08 13:13:23 +0100
commitbfb99eebd101fff1e15783c8fe4f00398c8052b3 (patch)
tree6bbf75f4de24435304d5055234953900008b076b
parenta87754b68bb1eb07397d71a93ffcb0f3fc089266 (diff)
Allow leaving groupchat channels.
-rw-r--r--irc.h3
-rw-r--r--irc_channel.c4
-rw-r--r--irc_im.c14
3 files changed, 20 insertions, 1 deletions
diff --git a/irc.h b/irc.h
index 34533728..e28182ce 100644
--- a/irc.h
+++ b/irc.h
@@ -152,6 +152,9 @@ typedef struct irc_channel
struct irc_channel_funcs
{
gboolean (*privmsg)( irc_channel_t *ic, const char *msg );
+ gboolean (*join)( irc_channel_t *ic );
+ gboolean (*part)( irc_channel_t *ic, const char *msg );
+ gboolean (*topic)( irc_channel_t *ic, const char *new );
};
typedef enum
diff --git a/irc_channel.c b/irc_channel.c
index 63c46d95..c8ee7a92 100644
--- a/irc_channel.c
+++ b/irc_channel.c
@@ -122,7 +122,11 @@ int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu )
irc_send_part( ic, iu, "" );
if( iu == ic->irc->user )
+ {
ic->flags &= ~IRC_CHANNEL_JOINED;
+ if( ic->f->part )
+ ic->f->part( ic, NULL );
+ }
return 1;
}
diff --git a/irc_im.c b/irc_im.c
index a6aa6052..fad02659 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -338,7 +338,6 @@ static gboolean bee_irc_chat_remove_user( bee_t *bee, struct groupchat *c, bee_u
}
/* IRC->IM */
-
static gboolean bee_irc_channel_chat_privmsg( irc_channel_t *ic, const char *msg )
{
struct groupchat *c = ic->data;
@@ -349,8 +348,21 @@ static gboolean bee_irc_channel_chat_privmsg( irc_channel_t *ic, const char *msg
}
+static gboolean bee_irc_channel_chat_part( irc_channel_t *ic, const char *msg )
+{
+ struct groupchat *c = ic->data;
+
+ if( c->ic->acc->prpl->chat_leave )
+ c->ic->acc->prpl->chat_leave( c );
+
+ return TRUE;
+
+}
+
static const struct irc_channel_funcs irc_channel_im_chat_funcs = {
bee_irc_channel_chat_privmsg,
+ NULL,
+ bee_irc_channel_chat_part,
};