Changeset 9e27f18


Ignore:
Timestamp:
2010-05-08T13:11:09Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
b0364dc
Parents:
d343eaa
Message:

Support for receiving chatroom topics. Since I didn't restore named chatroom
support I could only test this using gdb.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    rd343eaa r9e27f18  
    338338}
    339339
     340static gboolean bee_irc_chat_topic( bee_t *bee, struct groupchat *c, const char *new, bee_user_t *bu )
     341{
     342        irc_t *irc = bee->ui_data;
     343        irc_user_t *iu;
     344       
     345        if( bu == NULL )
     346                iu = irc->root;
     347        else if( bu == bee->user )
     348                iu = irc->user;
     349        else
     350                iu = bu->ui_data;
     351       
     352        irc_channel_set_topic( c->ui_data, new, iu );
     353       
     354        return TRUE;
     355}
     356
    340357static gboolean bee_irc_chat_name_hint( bee_t *bee, struct groupchat *c, const char *name )
    341358{
     
    391408}
    392409
     410static gboolean bee_irc_channel_chat_topic( irc_channel_t *ic, const char *new )
     411{
     412}
     413
    393414static const struct irc_channel_funcs irc_channel_im_chat_funcs = {
    394415        bee_irc_channel_chat_privmsg,
    395416        NULL, /* join */
    396417        bee_irc_channel_chat_part,
    397         NULL, /* topic */
     418        bee_irc_channel_chat_topic,
    398419};
    399420
     
    439460        bee_irc_chat_add_user,
    440461        bee_irc_chat_remove_user,
     462        bee_irc_chat_topic,
    441463        bee_irc_chat_name_hint,
    442464       
  • protocols/bee.h

    rd343eaa r9e27f18  
    8585        gboolean (*chat_add_user)( bee_t *bee, struct groupchat *c, bee_user_t *bu );
    8686        gboolean (*chat_remove_user)( bee_t *bee, struct groupchat *c, bee_user_t *bu );
     87        gboolean (*chat_topic)( bee_t *bee, struct groupchat *c, const char *new, bee_user_t *bu );
    8788        gboolean (*chat_name_hint)( bee_t *bee, struct groupchat *c, const char *name );
    8889       
  • protocols/bee_chat.c

    rd343eaa r9e27f18  
    124124void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at )
    125125{
    126 #if 0
    127         struct im_connection *ic = c->ic;
    128         user_t *u = NULL;
     126        struct im_connection *ic = c->ic;
     127        bee_t *bee = ic->bee;
     128        bee_user_t *bu;
     129       
     130        if( !bee->ui->chat_topic )
     131                return;
    129132       
    130133        if( who == NULL)
    131                 u = user_find( ic->irc, ic->irc->mynick );
     134                bu = NULL;
    132135        else if( g_strcasecmp( who, ic->acc->user ) == 0 )
    133                 u = user_find( ic->irc, ic->irc->nick );
    134         else
    135                 u = user_findhandle( ic, who );
     136                bu = bee->user;
     137        else
     138                bu = bee_user_by_handle( bee, ic, who );
    136139       
    137140        if( ( g_strcasecmp( set_getstr( &ic->bee->set, "strip_html" ), "always" ) == 0 ) ||
     
    139142                strip_html( topic );
    140143       
    141         g_free( c->topic );
    142         c->topic = g_strdup( topic );
    143        
    144         if( c->joined && u )
    145                 irc_write( ic->irc, ":%s!%s@%s TOPIC %s :%s", u->nick, u->user, u->host, c->channel, topic );
    146 #endif
     144        bee->ui->chat_topic( bee, c, topic, bu );
    147145}
    148146
     
    206204        struct im_connection *ic = c->ic;
    207205        char *buf = NULL;
    208         int st;
    209206       
    210207        if( ( ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
Note: See TracChangeset for help on using the changeset viewer.