Ignore:
Timestamp:
2007-12-04T01:08:43Z (16 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
793cc25
Parents:
fa30fa5 (diff), aaf92a9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged in current devel

Wilmer van der Gaast 2007-12-02 Imported setuid() patch from Simo Leone <simo@archlinux...> with some

Wilmer van der Gaast 2007-12-02 Forgot to return something in jabber_chat_join_failed().
Wilmer van der Gaast 2007-12-02 Merging a change I should've pulled before committing three other changes.
Wilmer van der Gaast 2007-12-02 Added charset checks on incoming msgs (from the IRC side) to prevent possible
Wilmer van der Gaast 2007-12-02 Handling of presence-error packets (only useful for groupchats now), moved
Wilmer van der Gaast 2007-12-02 Defining DEBUG via CFLAGS so that it'll always be there, even when a file
Wilmer van der Gaast 2007-12-02 Removed retarded printf() (ARGH) and moved the event handling handling of
Wilmer van der Gaast 2007-11-29 printf() in daemons considered harmful.
Wilmer van der Gaast 2007-11-28 Fixed the epoll+ForkDaemon combination. The libevent event handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/conference.c

    rfa30fa5 r08135df  
    2424#include "jabber.h"
    2525
     26static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
     27
    2628struct groupchat *jabber_chat_join( struct im_connection *ic, char *room, char *nick, char *password )
    2729{
     
    3537        xt_add_attr( node, "xmlns", XMLNS_MUC );
    3638        node = jabber_make_packet( "presence", NULL, roomjid, node );
     39        jabber_cache_add( ic, node, jabber_chat_join_failed );
    3740       
    3841        if( !jabber_write_packet( ic, node ) )
    3942        {
    4043                g_free( roomjid );
    41                 xt_free_node( node );
    4244                return NULL;
    4345        }
    44         xt_free_node( node );
    4546       
    4647        jc = g_new0( struct jabber_chat, 1 );
     
    6364       
    6465        return c;
     66}
     67
     68static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
     69{
     70        struct jabber_error *err;
     71        struct jabber_buddy *bud;
     72        char *room;
     73       
     74        room = xt_find_attr( orig, "to" );
     75        if( ( bud = jabber_buddy_by_jid( ic, room, 0 ) ) )
     76                jabber_chat_free( jabber_chat_by_jid( ic, bud->bare_jid ) );
     77       
     78        err = jabber_error_parse( xt_find_node( node->children, "error" ), XMLNS_STANZA_ERROR );
     79        if( err )
     80        {
     81                imcb_error( ic, "Error joining groupchat %s: %s%s%s",
     82                            bud->bare_jid, err->code, err->text ? ": " : "",
     83                            err->text ? err->text : "" );
     84                jabber_error_free( err );
     85        }
     86       
     87        return XT_HANDLED;
     88}
     89
     90struct groupchat *jabber_chat_by_jid( struct im_connection *ic, const char *name )
     91{
     92        char *normalized = jabber_normalize( name );
     93        struct groupchat *ret;
     94        struct jabber_chat *jc;
     95       
     96        for( ret = ic->groupchats; ret; ret = ret->next )
     97        {
     98                jc = ret->data;
     99                if( strcmp( normalized, jc->name ) == 0 )
     100                        break;
     101        }
     102        g_free( normalized );
     103       
     104        return ret;
    65105}
    66106
     
    148188        char *s;
    149189       
    150         if( ( chat = jabber_chat_by_name( ic, bud->bare_jid ) ) == NULL )
     190        if( ( chat = jabber_chat_by_jid( ic, bud->bare_jid ) ) == NULL )
    151191        {
    152192                /* How could this happen?? We could do kill( self, 11 )
     
    250290                return;
    251291        }
    252         else if( ( chat = jabber_chat_by_name( ic, bud->bare_jid ) ) == NULL )
     292        else if( ( chat = jabber_chat_by_jid( ic, bud->bare_jid ) ) == NULL )
    253293        {
    254294                /* How could this happen?? We could do kill( self, 11 )
Note: See TracChangeset for help on using the changeset viewer.