Changeset 5a75d15 for irc_channel.c


Ignore:
Timestamp:
2010-06-05T22:32:36Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
c1a8a16
Parents:
f5d87ea
Message:

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).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_channel.c

    rf5d87ea r5a75d15  
    2929static gint irc_channel_user_cmp( gconstpointer a_, gconstpointer b_ );
    3030static const struct irc_channel_funcs control_channel_funcs;
    31 static const struct irc_channel_funcs groupchat_stub_funcs;
     31
     32extern const struct irc_channel_funcs irc_channel_im_chat_funcs;
    3233
    3334irc_channel_t *irc_channel_new( irc_t *irc, const char *name )
     
    104105                new = &control_channel_funcs;
    105106        else if( strcmp( value, "chat" ) == 0 )
    106                 new = &groupchat_stub_funcs;
     107                new = &irc_channel_im_chat_funcs;
    107108        else
    108109                return SET_INVALID;
     
    389390        control_channel_free,
    390391};
    391 
    392 /* Groupchat stub: Only handles /INVITE at least for now. */
    393 static gboolean groupchat_stub_invite( irc_channel_t *ic, irc_user_t *iu )
    394 {
    395         bee_user_t *bu = iu->bu;
    396        
    397         if( iu->bu->ic->acc->prpl->chat_with )
    398         {
    399                 ic->flags |= IRC_CHANNEL_CHAT_PICKME;
    400                 iu->bu->ic->acc->prpl->chat_with( bu->ic, bu->handle );
    401                 ic->flags &= ~IRC_CHANNEL_CHAT_PICKME;
    402                 return TRUE;
    403         }
    404         else
    405         {
    406                 irc_send_num( ic->irc, 482, "%s :IM protocol does not support room invitations", ic->name );
    407                 return FALSE;
    408         }
    409 }
    410 
    411 static gboolean groupchat_stub_join( irc_channel_t *ic )
    412 {
    413         struct irc_groupchat_stub *igs = ic->data;
    414        
    415         if( igs && igs->acc->ic && igs->acc->prpl->chat_join )
    416         {
    417                 ic->flags |= IRC_CHANNEL_CHAT_PICKME;
    418                 igs->acc->prpl->chat_join( igs->acc->ic, igs->room, ic->irc->user->nick, NULL );
    419                 ic->flags &= ~IRC_CHANNEL_CHAT_PICKME;
    420                 return FALSE;
    421         }
    422         else
    423         {
    424                 irc_send_num( ic->irc, 403, "%s :Can't join channel, account offline?", ic->name );
    425                 return FALSE;
    426         }
    427 }
    428 
    429 static const struct irc_channel_funcs groupchat_stub_funcs = {
    430         NULL,
    431         groupchat_stub_join,
    432         NULL,
    433         NULL,
    434         groupchat_stub_invite,
    435 };
Note: See TracChangeset for help on using the changeset viewer.