Changeset ef5c185 for protocols/jabber


Ignore:
Timestamp:
2007-11-19T23:14:39Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
256899f
Parents:
50e1776
Message:

Added Jabber groupchat topic support.

Location:
protocols/jabber
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/conference.c

    r50e1776 ref5c185  
    8585       
    8686        node = xt_new_node( "body", message, NULL );
     87        node = jabber_make_packet( "message", "groupchat", jc->name, node );
     88       
     89        if( !jabber_write_packet( ic, node ) )
     90        {
     91                xt_free_node( node );
     92                return 0;
     93        }
     94        xt_free_node( node );
     95       
     96        return 1;
     97}
     98
     99int jabber_chat_topic( struct groupchat *c, char *topic )
     100{
     101        struct im_connection *ic = c->ic;
     102        struct jabber_chat *jc = c->data;
     103        struct xt_node *node;
     104       
     105        node = xt_new_node( "subject", topic, NULL );
    87106        node = jabber_make_packet( "message", "groupchat", jc->name, node );
    88107       
     
    214233void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node )
    215234{
     235        struct xt_node *subject = xt_find_node( node->children, "subject" );
    216236        struct xt_node *body = xt_find_node( node->children, "body" );
    217237        struct groupchat *chat;
     
    237257        }
    238258       
     259        if( subject )
     260        {
     261                s = strchr( bud->ext_jid, '/' );
     262                if( s ) *s = 0;
     263                imcb_chat_topic( chat, bud->ext_jid, subject->text_len > 0 ?
     264                                 subject->text : NULL, jabber_get_timestamp( node ) );
     265                if( s ) *s = '/';
     266        }
    239267        if( body && body->text_len > 0 )
    240268        {
  • protocols/jabber/jabber.c

    r50e1776 ref5c185  
    385385}
    386386
     387static void jabber_chat_topic_( struct groupchat *c, char *topic )
     388{
     389        if( c && topic )
     390                jabber_chat_topic( c, topic );
     391}
     392
    387393static void jabber_chat_leave_( struct groupchat *c )
    388394{
     
    461467        ret->remove_buddy = jabber_remove_buddy;
    462468        ret->chat_msg = jabber_chat_msg_;
     469        ret->chat_topic = jabber_chat_topic_;
    463470//      ret->chat_invite = jabber_chat_invite;
    464471        ret->chat_leave = jabber_chat_leave_;
  • protocols/jabber/jabber.h

    r50e1776 ref5c185  
    229229void jabber_chat_free( struct groupchat *c );
    230230int jabber_chat_msg( struct groupchat *ic, char *message, int flags );
     231int jabber_chat_topic( struct groupchat *c, char *topic );
    231232int jabber_chat_leave( struct groupchat *c, const char *reason );
    232233void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node );
  • protocols/jabber/sasl.c

    r50e1776 ref5c185  
    332332        struct jabber_data *jd = ic->proto_data;
    333333       
    334         return ( (void*) ( jd->xt && jd->xt->root && xt_find_attr( jd->xt->root, "version" ) ) ) != NULL;
    335 }
     334        return ( jd->xt && jd->xt->root && xt_find_attr( jd->xt->root, "version" ) ) != 0;
     335}
Note: See TracChangeset for help on using the changeset viewer.