Changeset eb37735 for irc_channel.c


Ignore:
Timestamp:
2010-05-08T23:54:37Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
36577aa
Parents:
66b9e36a
Message:

This is how you now start groupchats: /join #channel, /invite people.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_channel.c

    r66b9e36a reb37735  
    2828static gint irc_channel_user_cmp( gconstpointer a_, gconstpointer b_ );
    2929static const struct irc_channel_funcs control_channel_funcs;
     30static const struct irc_channel_funcs groupchat_stub_funcs;
    3031
    3132irc_channel_t *irc_channel_new( irc_t *irc, const char *name )
     
    3738       
    3839        ic = g_new0( irc_channel_t, 1 );
    39         ic->f = &control_channel_funcs;
    4040        ic->irc = irc;
    4141        ic->name = g_strdup( name );
     
    4848       
    4949        irc->channels = g_slist_prepend( irc->channels, ic );
     50       
     51        if( name[0] == '&' )
     52                ic->f = &control_channel_funcs;
     53        else /* if( name[0] == '#' ) */
     54                ic->f = &groupchat_stub_funcs;
    5055       
    5156        return ic;
     
    251256        control_channel_privmsg,
    252257};
     258
     259/* Groupchat stub: Only handles /INVITE at least for now. */
     260static gboolean groupchat_stub_invite( irc_channel_t *ic, irc_user_t *iu )
     261{
     262        bee_user_t *bu = iu->bu;
     263       
     264        if( iu->bu->ic->acc->prpl->chat_with )
     265        {
     266                ic->flags |= IRC_CHANNEL_CHAT_PICKME;
     267                iu->bu->ic->acc->prpl->chat_with( bu->ic, bu->handle );
     268                ic->flags &= ~IRC_CHANNEL_CHAT_PICKME;
     269                return TRUE;
     270        }
     271        else
     272        {
     273                irc_send_num( ic->irc, 482, "%s :IM protocol does not support room invitations", ic->name );
     274                return FALSE;
     275        }
     276}
     277
     278static const struct irc_channel_funcs groupchat_stub_funcs = {
     279        NULL,
     280        NULL,
     281        NULL,
     282        NULL,
     283        groupchat_stub_invite,
     284};
Note: See TracChangeset for help on using the changeset viewer.