Changeset a87754b


Ignore:
Timestamp:
2010-05-08T01:02:12Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
bfb99ee
Parents:
e4816ea
Message:

Restored support for outgoing messages. This code is all so much saner now..

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    re4816ea ra87754b  
    152152struct irc_channel_funcs
    153153{
    154         gboolean (*privmsg)( irc_channel_t *iu, const char *msg );
     154        gboolean (*privmsg)( irc_channel_t *ic, const char *msg );
    155155};
    156156
  • irc_im.c

    re4816ea ra87754b  
    252252
    253253/* IM->IRC: Groupchats */
    254 gboolean bee_irc_chat_new( bee_t *bee, struct groupchat *c )
     254static const struct irc_channel_funcs irc_channel_im_chat_funcs;
     255
     256static gboolean bee_irc_chat_new( bee_t *bee, struct groupchat *c )
    255257{
    256258        irc_t *irc = bee->ui_data;
     
    272274        c->ui_data = ic;
    273275        ic->data = c;
     276        ic->f = &irc_channel_im_chat_funcs;
    274277       
    275278        topic = g_strdup_printf( "BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", c->title );
     
    280283}
    281284
    282 gboolean bee_irc_chat_free( bee_t *bee, struct groupchat *c )
     285static gboolean bee_irc_chat_free( bee_t *bee, struct groupchat *c )
    283286{
    284287        irc_channel_t *ic = c->ui_data;
     
    292295}
    293296
    294 gboolean bee_irc_chat_log( bee_t *bee, struct groupchat *c, const char *text )
     297static gboolean bee_irc_chat_log( bee_t *bee, struct groupchat *c, const char *text )
    295298{
    296299        irc_channel_t *ic = c->ui_data;
     
    301304}
    302305
    303 gboolean bee_irc_chat_msg( bee_t *bee, struct groupchat *c, bee_user_t *bu, const char *msg, time_t sent_at )
     306static gboolean bee_irc_chat_msg( bee_t *bee, struct groupchat *c, bee_user_t *bu, const char *msg, time_t sent_at )
    304307{
    305308        irc_t *irc = bee->ui_data;
     
    317320}
    318321
    319 gboolean bee_irc_chat_add_user( bee_t *bee, struct groupchat *c, bee_user_t *bu )
     322static gboolean bee_irc_chat_add_user( bee_t *bee, struct groupchat *c, bee_user_t *bu )
    320323{
    321324        irc_t *irc = bee->ui_data;
     
    326329}
    327330
    328 gboolean bee_irc_chat_remove_user( bee_t *bee, struct groupchat *c, bee_user_t *bu )
     331static gboolean bee_irc_chat_remove_user( bee_t *bee, struct groupchat *c, bee_user_t *bu )
    329332{
    330333        irc_t *irc = bee->ui_data;
     
    334337        return TRUE;
    335338}
     339
     340/* IRC->IM */
     341
     342static gboolean bee_irc_channel_chat_privmsg( irc_channel_t *ic, const char *msg )
     343{
     344        struct groupchat *c = ic->data;
     345       
     346        bee_chat_msg( ic->irc->b, c, msg, 0 );
     347       
     348        return TRUE;
     349       
     350}
     351
     352static const struct irc_channel_funcs irc_channel_im_chat_funcs = {
     353        bee_irc_channel_chat_privmsg,
     354};
    336355
    337356
     
    342361}
    343362
    344 gboolean bee_irc_ft_out_start( struct im_connection *ic, file_transfer_t *ft )
     363static gboolean bee_irc_ft_out_start( struct im_connection *ic, file_transfer_t *ft )
    345364{
    346365        return dccs_recv_start( ft );
    347366}
    348367
    349 void bee_irc_ft_close( struct im_connection *ic, file_transfer_t *ft )
     368static void bee_irc_ft_close( struct im_connection *ic, file_transfer_t *ft )
    350369{
    351370        return dcc_close( ft );
    352371}
    353372
    354 void bee_irc_ft_finished( struct im_connection *ic, file_transfer_t *file )
     373static void bee_irc_ft_finished( struct im_connection *ic, file_transfer_t *file )
    355374{
    356375        dcc_file_transfer_t *df = file->priv;
  • protocols/bee.h

    re4816ea ra87754b  
    126126static int remove_chat_buddy_silent( struct groupchat *b, const char *handle );
    127127#endif
     128int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags );
    128129
    129130#endif /* __BEE_H__ */
  • protocols/bee_chat.c

    re4816ea ra87754b  
    247247}
    248248#endif
     249
     250int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags )
     251{
     252        struct im_connection *ic = c->ic;
     253        char *buf = NULL;
     254        int st;
     255       
     256        if( ( ic->flags & OPT_DOES_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
     257        {
     258                buf = escape_html( msg );
     259                msg = buf;
     260        }
     261        else
     262                buf = g_strdup( msg );
     263       
     264        ic->acc->prpl->chat_msg( c, buf, flags );
     265        g_free( buf );
     266       
     267        return 1;
     268}
Note: See TracChangeset for help on using the changeset viewer.