diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-09 00:54:37 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-09 00:54:37 +0100 | 
| commit | eb37735451207895e7e1b5b3dcc0f9cbe178ad38 (patch) | |
| tree | 0e64d60cc7fdefc9d6fd8f6a4d7d789612a62d89 /irc_channel.c | |
| parent | 66b9e36aa9dfd123c66194d645a3c60cc3dc49bc (diff) | |
This is how you now start groupchats: /join #channel, /invite people.
Diffstat (limited to 'irc_channel.c')
| -rw-r--r-- | irc_channel.c | 34 | 
1 files changed, 33 insertions, 1 deletions
| diff --git a/irc_channel.c b/irc_channel.c index 2ff00068..2c6601d2 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -27,6 +27,7 @@  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;  irc_channel_t *irc_channel_new( irc_t *irc, const char *name )  { @@ -36,7 +37,6 @@ irc_channel_t *irc_channel_new( irc_t *irc, const char *name )  		return NULL;  	ic = g_new0( irc_channel_t, 1 ); -	ic->f = &control_channel_funcs;  	ic->irc = irc;  	ic->name = g_strdup( name );  	strcpy( ic->mode, CMODE ); @@ -48,6 +48,11 @@ irc_channel_t *irc_channel_new( irc_t *irc, const char *name )  	irc->channels = g_slist_prepend( irc->channels, ic ); +	if( name[0] == '&' ) +		ic->f = &control_channel_funcs; +	else /* if( name[0] == '#' ) */ +		ic->f = &groupchat_stub_funcs; +	  	return ic;  } @@ -250,3 +255,30 @@ static gboolean control_channel_privmsg( irc_channel_t *ic, const char *msg )  static const struct irc_channel_funcs control_channel_funcs = {  	control_channel_privmsg,  }; + +/* 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 const struct irc_channel_funcs groupchat_stub_funcs = { +	NULL, +	NULL, +	NULL, +	NULL, +	groupchat_stub_invite, +}; | 
