diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-05 23:32:36 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-05 23:32:36 +0100 |
commit | 5a75d1586478f78446b6c78b161572fc7cabe4d9 (patch) | |
tree | dc0d9edb7da103ce60229b5118db4a5f29821bba /irc_channel.c | |
parent | f5d87ea5e4db1864cc9dd95c295f166af9944014 (diff) |
Chatroom improvements. Merged chatroom stub into normal chatroom stuff,
restored "chat add" behaviour a little bit better (don't clean up a
channel when its room disappears, just disconnect it from the groupchat).
Diffstat (limited to 'irc_channel.c')
-rw-r--r-- | irc_channel.c | 50 |
1 files changed, 3 insertions, 47 deletions
diff --git a/irc_channel.c b/irc_channel.c index 64bbd614..bceb067c 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -28,7 +28,8 @@ static char *set_eval_channel_type( set_t *set, char *value ); static gint irc_channel_user_cmp( gconstpointer a_, gconstpointer b_ ); static const struct irc_channel_funcs control_channel_funcs; -static const struct irc_channel_funcs groupchat_stub_funcs; + +extern const struct irc_channel_funcs irc_channel_im_chat_funcs; irc_channel_t *irc_channel_new( irc_t *irc, const char *name ) { @@ -103,7 +104,7 @@ static char *set_eval_channel_type( set_t *set, char *value ) if( strcmp( value, "control" ) == 0 ) new = &control_channel_funcs; else if( strcmp( value, "chat" ) == 0 ) - new = &groupchat_stub_funcs; + new = &irc_channel_im_chat_funcs; else return SET_INVALID; @@ -388,48 +389,3 @@ static const struct irc_channel_funcs control_channel_funcs = { control_channel_init, control_channel_free, }; - -/* Groupchat stub: Only handles /INVITE at least for now. */ -static gboolean groupchat_stub_invite( irc_channel_t *ic, irc_user_t *iu ) -{ - bee_user_t *bu = iu->bu; - - if( iu->bu->ic->acc->prpl->chat_with ) - { - ic->flags |= IRC_CHANNEL_CHAT_PICKME; - iu->bu->ic->acc->prpl->chat_with( bu->ic, bu->handle ); - ic->flags &= ~IRC_CHANNEL_CHAT_PICKME; - return TRUE; - } - else - { - irc_send_num( ic->irc, 482, "%s :IM protocol does not support room invitations", ic->name ); - return FALSE; - } -} - -static gboolean groupchat_stub_join( irc_channel_t *ic ) -{ - struct irc_groupchat_stub *igs = ic->data; - - if( igs && igs->acc->ic && igs->acc->prpl->chat_join ) - { - ic->flags |= IRC_CHANNEL_CHAT_PICKME; - igs->acc->prpl->chat_join( igs->acc->ic, igs->room, ic->irc->user->nick, NULL ); - ic->flags &= ~IRC_CHANNEL_CHAT_PICKME; - return FALSE; - } - else - { - irc_send_num( ic->irc, 403, "%s :Can't join channel, account offline?", ic->name ); - return FALSE; - } -} - -static const struct irc_channel_funcs groupchat_stub_funcs = { - NULL, - groupchat_stub_join, - NULL, - NULL, - groupchat_stub_invite, -}; |