Changeset eb37735


Ignore:
Timestamp:
2010-05-08T23:54:37Z (14 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.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    r66b9e36a reb37735  
    131131{
    132132        IRC_CHANNEL_JOINED = 1,
    133         IRC_CHANNEL_CONTACTS = 256,
     133       
     134        /* Hack: Set this flag right before jumping into IM when we expect
     135           a call to imcb_chat_new(). */
     136        IRC_CHANNEL_CHAT_PICKME = 0x10000,
    134137} irc_channel_flags_t;
    135138
  • 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};
  • irc_im.c

    r66b9e36a reb37735  
    259259        irc_channel_t *ic;
    260260        char *topic;
     261        GSList *l;
    261262        int i;
    262263       
    263         for( i = 0; i <= 999; i ++ )
     264        /* Try to find a channel that expects to receive a groupchat.
     265           This flag is set by groupchat_stub_invite(). */
     266        for( l = irc->channels; l; l = l->next )
     267        {
     268                ic = l->data;
     269                if( ic->flags & IRC_CHANNEL_CHAT_PICKME )
     270                        break;
     271        }
     272       
     273        /* If we found none, just generate some stupid name. */
     274        if( l == NULL ) for( i = 0; i <= 999; i ++ )
    264275        {
    265276                char name[16];
Note: See TracChangeset for help on using the changeset viewer.