Changeset 885d294 for protocols


Ignore:
Timestamp:
2015-01-16T19:50:24Z (5 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
7549d00
Parents:
eabe6d4
git-author:
jgeboski <jgeboski@…> (16-01-15 19:50:24)
git-committer:
dequis <dx@…> (16-01-15 19:50:24)
Message:

bee-chat: create temporary users for unknown chat participants

The imcb_chat_msg() function is unable to send messages to a chat with
a user who was not previously added. This function should allow for the
sending of messages with users who are not added. This is suitable for
protocols which are sending messages to a chat from random users or a
large amount of users which join and part frequently.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/bee_chat.c

    reabe6d4 r885d294  
    8585        bee_t *bee = ic->bee;
    8686        bee_user_t *bu;
     87        gboolean temp;
    8788        char *s;
    8889       
     
    9293       
    9394        bu = bee_user_by_handle( bee, ic, who );
     95        temp = ( bu == NULL );
     96       
     97        if( temp )
     98                bu = bee_user_new( bee, ic, who, BEE_USER_ONLINE );
    9499       
    95100        s = set_getstr( &ic->bee->set, "strip_html" );
     
    98103                strip_html( msg );
    99104       
    100         if( bu && bee->ui->chat_msg )
     105        if( bee->ui->chat_msg )
    101106                bee->ui->chat_msg( bee, c, bu, msg, sent_at );
    102         else
    103                 imcb_chat_log( c, "Message from unknown participant %s: %s", who, msg );
     107       
     108        if( temp )
     109                bee_user_free( bee, bu );
    104110}
    105111
Note: See TracChangeset for help on using the changeset viewer.