Changeset 03f3828


Ignore:
Timestamp:
2010-07-24T14:06:22Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
7989d40d
Parents:
c8791f2
Message:

Adding protocol-specific chatroom settings. First one to use this: AIM
chatrooms to use exchange numbers other than 4.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    rc8791f2 r03f3828  
    693693               
    694694                ic->flags |= IRC_CHANNEL_CHAT_PICKME;
    695                 acc->prpl->chat_join( acc->ic, room, nick, NULL );
     695                acc->prpl->chat_join( acc->ic, room, nick, NULL, &ic->set );
    696696                ic->flags &= ~IRC_CHANNEL_CHAT_PICKME;
    697697               
     
    788788{
    789789        struct irc_channel *ic = set->data;
    790         account_t *acc;
     790        account_t *acc, *oa;
    791791       
    792792        if( !( acc = account_get( ic->irc->b, value ) ) )
     
    797797                return SET_INVALID;
    798798        }
     799       
     800        if( set->value && ( oa = account_get( ic->irc->b, set->value ) ) &&
     801            oa->prpl->chat_free_settings )
     802                oa->prpl->chat_free_settings( oa, &ic->set );
     803       
     804        if( acc->prpl->chat_add_settings )
     805                acc->prpl->chat_add_settings( acc, &ic->set );
    799806       
    800807        return g_strdup_printf( "%s(%s)", acc->prpl->name, acc->user );
  • protocols/jabber/jabber.c

    rc8791f2 r03f3828  
    441441}
    442442
    443 static struct groupchat *jabber_chat_join_( struct im_connection *ic, const char *room, const char *nick, const char *password )
     443static struct groupchat *jabber_chat_join_( struct im_connection *ic, const char *room, const char *nick, const char *password, set_t **sets )
    444444{
    445445        if( strchr( room, '@' ) == NULL )
  • protocols/nogaim.h

    rc8791f2 r03f3828  
    212212         * not implement this. */
    213213        struct groupchat *
    214              (* chat_join)      (struct im_connection *, const char *room, const char *nick, const char *password);
     214             (* chat_join)      (struct im_connection *, const char *room,
     215                                 const char *nick, const char *password, set_t **sets);
    215216        /* Change the topic, if supported. Note that BitlBee expects the IM
    216217           server to confirm the topic change with a regular topic change
     
    219220        void (* chat_topic)     (struct groupchat *, char *topic);
    220221       
     222        /* If your protocol module needs any special info for joining chatrooms
     223           other than a roomname + nickname, add them here. */
     224        void (* chat_add_settings)      (account_t *acc, set_t **head);
     225        void (* chat_free_settings)     (account_t *acc, set_t **head);
     226       
    221227        /* You can tell what away states your protocol supports, so that
    222228         * BitlBee will try to map the IRC away reasons to them. If your
     
    234240        /* Incoming transfer request */
    235241        void (* transfer_request) (struct im_connection *, file_transfer_t *ft, char *handle );
     242       
     243        /* Some placeholders so eventually older plugins may cooperate with newer BitlBees. */
     244        void *resv1;
     245        void *resv2;
     246        void *resv3;
     247        void *resv4;
     248        void *resv5;
    236249};
    237250
  • protocols/oscar/oscar.c

    rc8791f2 r03f3828  
    25062506}
    25072507
    2508 struct groupchat *oscar_chat_join(struct im_connection * ic, const char * room, const char * nick, const char * password )
     2508struct groupchat *oscar_chat_join_internal(struct im_connection *ic, const char *room,
     2509        const char *nick, const char *password, int exchange_number)
    25092510{
    25102511        struct oscar_data * od = (struct oscar_data *)ic->proto_data;
     
    25142515                int st;
    25152516               
    2516                 st = aim_chatnav_createroom(od->sess, cur, room, 4);
     2517                st = aim_chatnav_createroom(od->sess, cur, room, exchange_number);
    25172518               
    25182519                return NULL;
     
    25202521                struct create_room * cr = g_new0(struct create_room, 1);
    25212522               
    2522                 cr->exchange = 4;
     2523                cr->exchange = exchange_number;
    25232524                cr->name = g_strdup(room);
    25242525                od->create_rooms = g_slist_append(od->create_rooms, cr);
     
    25292530}
    25302531
     2532struct groupchat *oscar_chat_join(struct im_connection *ic, const char *room,
     2533        const char *nick, const char *password, set_t **sets)
     2534{
     2535        return oscar_chat_join_internal(ic, room, nick, password, set_getint(sets, "exchange_number"));
     2536}
     2537
    25312538struct groupchat *oscar_chat_with(struct im_connection * ic, char *who)
    25322539{
     
    25452552       
    25462553        c = imcb_chat_new(ic, chatname);
    2547         ret = oscar_chat_join(ic, chatname, NULL, NULL);
     2554        ret = oscar_chat_join_internal(ic, chatname, NULL, NULL, 4);
    25482555        aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0);
    25492556
     
    25572564        struct aim_chat_invitation * inv = data;
    25582565       
    2559         oscar_chat_join(inv->ic, inv->name, NULL, NULL);
     2566        oscar_chat_join_internal(inv->ic, inv->name, NULL, NULL, 4);
    25602567        g_free(inv->name);
    25612568        g_free(inv);
     
    25682575        g_free(inv->name);
    25692576        g_free(inv);
     2577}
     2578
     2579void oscar_chat_add_settings(account_t *acc, set_t **head)
     2580{
     2581        set_add(head, "exchange_number", "4", set_eval_int, NULL);
     2582}
     2583
     2584void oscar_chat_free_settings(account_t *acc, set_t **head)
     2585{
     2586        set_del(head, "exchange_number");
    25702587}
    25712588
     
    25902607        ret->chat_with = oscar_chat_with;
    25912608        ret->chat_join = oscar_chat_join;
     2609        ret->chat_add_settings = oscar_chat_add_settings;
     2610        ret->chat_free_settings = oscar_chat_free_settings;
    25922611        ret->add_permit = oscar_add_permit;
    25932612        ret->add_deny = oscar_add_deny;
Note: See TracChangeset for help on using the changeset viewer.