Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    rdf1fb67 r9da0bbf  
    197197        jabber_end_stream( ic );
    198198       
     199        while( ic->groupchats )
     200                jabber_chat_free( ic->groupchats );
     201       
    199202        if( jd->r_inpa >= 0 )
    200203                b_event_remove( jd->r_inpa );
     
    224227        struct jabber_buddy *bud;
    225228        struct xt_node *node;
     229        char *s;
    226230        int st;
    227231       
    228         bud = jabber_buddy_by_jid( ic, who, 0 );
     232        if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 )
     233                return jabber_write( ic, message, strlen( message ) );
     234       
     235        if( ( s = strchr( who, '=' ) ) && jabber_chat_by_name( ic, s + 1 ) )
     236                bud = jabber_buddy_by_ext_jid( ic, who, 0 );
     237        else
     238                bud = jabber_buddy_by_jid( ic, who, 0 );
    229239       
    230240        node = xt_new_node( "body", message, NULL );
     
    311321static void jabber_add_buddy( struct im_connection *ic, char *who, char *group )
    312322{
     323        struct jabber_data *jd = ic->proto_data;
     324       
     325        if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 )
     326        {
     327                jd->flags |= JFLAG_XMLCONSOLE;
     328                imcb_add_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL );
     329                return;
     330        }
     331       
    313332        if( jabber_add_to_roster( ic, who, NULL ) )
    314333                presence_send_request( ic, who, "subscribe" );
     
    317336static void jabber_remove_buddy( struct im_connection *ic, char *who, char *group )
    318337{
     338        struct jabber_data *jd = ic->proto_data;
     339       
     340        if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 )
     341        {
     342                jd->flags &= ~JFLAG_XMLCONSOLE;
     343                /* Not necessary for now. And for now the code isn't too
     344                   happy if the buddy is completely gone right after calling
     345                   this function already.
     346                imcb_remove_buddy( ic, JABBER_XMLCONSOLE_HANDLE, NULL );
     347                */
     348                return;
     349        }
     350       
    319351        /* We should always do this part. Clean up our administration a little bit. */
    320352        jabber_buddy_remove_bare( ic, who );
     
    322354        if( jabber_remove_from_roster( ic, who ) )
    323355                presence_send_request( ic, who, "unsubscribe" );
     356}
     357
     358static struct groupchat *jabber_chat_join_( struct im_connection *ic, char *room, char *nick, char *password )
     359{
     360        if( strchr( room, '@' ) == NULL )
     361                imcb_error( ic, "Invalid room name: %s", room );
     362        else if( jabber_chat_by_name( ic, room ) )
     363                imcb_error( ic, "Already present in chat `%s'", room );
     364        else
     365                return jabber_chat_join( ic, room, nick, password );
     366       
     367        return NULL;
     368}
     369
     370static void jabber_chat_msg_( struct groupchat *c, char *message, int flags )
     371{
     372        if( c && message )
     373                jabber_chat_msg( c, message, flags );
     374}
     375
     376static void jabber_chat_leave_( struct groupchat *c )
     377{
     378        if( c )
     379                jabber_chat_leave( c, NULL );
    324380}
    325381
     
    388444        ret->buddy_msg = jabber_buddy_msg;
    389445        ret->away_states = jabber_away_states;
    390 //      ret->get_status_string = jabber_get_status_string;
    391446        ret->set_away = jabber_set_away;
    392447//      ret->set_info = jabber_set_info;
     
    394449        ret->add_buddy = jabber_add_buddy;
    395450        ret->remove_buddy = jabber_remove_buddy;
    396 //      ret->chat_msg = jabber_chat_msg;
     451        ret->chat_msg = jabber_chat_msg_;
    397452//      ret->chat_invite = jabber_chat_invite;
    398 //      ret->chat_leave = jabber_chat_leave;
    399 //      ret->chat_open = jabber_chat_open;
     453        ret->chat_leave = jabber_chat_leave_;
     454        ret->chat_join = jabber_chat_join_;
    400455        ret->keepalive = jabber_keepalive;
    401456        ret->send_typing = jabber_send_typing;
Note: See TracChangeset for help on using the changeset viewer.