aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/jabber')
-rw-r--r--protocols/jabber/conference.c6
-rw-r--r--protocols/jabber/iq.c9
-rw-r--r--protocols/jabber/jabber.c4
-rw-r--r--protocols/jabber/jabber_util.c8
-rw-r--r--protocols/jabber/presence.c5
-rw-r--r--protocols/jabber/s5bytestream.c14
-rw-r--r--protocols/jabber/si.c10
7 files changed, 29 insertions, 27 deletions
diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c
index affe8aef..e04b9792 100644
--- a/protocols/jabber/conference.c
+++ b/protocols/jabber/conference.c
@@ -91,18 +91,20 @@ static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_no
struct groupchat *jabber_chat_by_jid( struct im_connection *ic, const char *name )
{
char *normalized = jabber_normalize( name );
+ GSList *l;
struct groupchat *ret;
struct jabber_chat *jc;
- for( ret = ic->groupchats; ret; ret = ret->next )
+ for( l = ic->groupchats; l; l = l->next )
{
+ ret = l->data;
jc = ret->data;
if( strcmp( normalized, jc->name ) == 0 )
break;
}
g_free( normalized );
- return ret;
+ return l ? ret : NULL;
}
void jabber_chat_free( struct groupchat *c )
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c
index 77c0d628..5166e322 100644
--- a/protocols/jabber/iq.c
+++ b/protocols/jabber/iq.c
@@ -381,7 +381,7 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *
c = query->children;
while( ( c = xt_find_node( c, "item" ) ) )
{
- struct xt_node *group = xt_find_node( node->children, "group" );
+ struct xt_node *group = xt_find_node( c->children, "group" );
char *jid = xt_find_attr( c, "jid" );
char *name = xt_find_attr( c, "name" );
char *sub = xt_find_attr( c, "subscription" );
@@ -390,9 +390,8 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *
{
if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) )
{
- if( initial || imcb_find_buddy( ic, jid ) == NULL )
- imcb_add_buddy( ic, jid, ( group && group->text_len ) ?
- group->text : NULL );
+ imcb_add_buddy( ic, jid, ( group && group->text_len ) ?
+ group->text : NULL );
if( name )
imcb_rename_buddy( ic, jid, name );
@@ -588,7 +587,7 @@ static xt_status jabber_add_to_roster_callback( struct im_connection *ic, struct
( s = xt_find_attr( node, "type" ) ) &&
strcmp( s, "result" ) == 0 )
{
- if( imcb_find_buddy( ic, jid ) == NULL )
+ if( bee_user_by_handle( ic->bee, ic, jid ) == NULL )
imcb_add_buddy( ic, jid, NULL );
}
else
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index 956769b7..75bc44d3 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -266,7 +266,7 @@ static void jabber_logout( struct im_connection *ic )
struct jabber_data *jd = ic->proto_data;
while( jd->filetransfers )
- imcb_file_canceled( ( ( struct jabber_transfer *) jd->filetransfers->data )->ft, "Logging out" );
+ imcb_file_canceled( ic, ( ( struct jabber_transfer *) jd->filetransfers->data )->ft, "Logging out" );
while( jd->streamhosts )
{
@@ -281,7 +281,7 @@ static void jabber_logout( struct im_connection *ic )
jabber_end_stream( ic );
while( ic->groupchats )
- jabber_chat_free( ic->groupchats );
+ jabber_chat_free( ic->groupchats->data );
if( jd->r_inpa >= 0 )
b_event_remove( jd->r_inpa );
diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c
index 4bc9e3a8..608cb52a 100644
--- a/protocols/jabber/jabber_util.c
+++ b/protocols/jabber/jabber_util.c
@@ -278,8 +278,7 @@ static void jabber_buddy_ask_yes( void *data )
presence_send_request( bla->ic, bla->handle, "subscribed" );
- if( imcb_find_buddy( bla->ic, bla->handle ) == NULL )
- imcb_ask_add( bla->ic, bla->handle, NULL );
+ imcb_ask_add( bla->ic, bla->handle, NULL );
g_free( bla->handle );
g_free( bla );
@@ -461,7 +460,7 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_,
}
if( bud == NULL && ( flags & GET_BUDDY_CREAT ) &&
- ( bare_exists || imcb_find_buddy( ic, jid ) ) )
+ ( bare_exists || bee_user_by_handle( ic->bee, ic, jid ) ) )
{
*s = '/';
bud = jabber_buddy_add( ic, jid );
@@ -482,7 +481,8 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_,
if( bud == NULL )
/* No match. Create it now? */
- return ( ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid_ ) ) ?
+ return ( ( flags & GET_BUDDY_CREAT ) &&
+ bee_user_by_handle( ic->bee, ic, jid_ ) ) ?
jabber_buddy_add( ic, jid_ ) : NULL;
else if( bud->resource && ( flags & GET_BUDDY_EXACT ) )
/* We want an exact match, so in thise case there shouldn't be a /resource. */
diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c
index 006eeead..2875d23e 100644
--- a/protocols/jabber/presence.c
+++ b/protocols/jabber/presence.c
@@ -204,7 +204,7 @@ int presence_send_update( struct im_connection *ic )
{
struct jabber_data *jd = ic->proto_data;
struct xt_node *node, *cap;
- struct groupchat *c;
+ GSList *l;
int st;
node = jabber_make_packet( "presence", NULL, NULL, NULL );
@@ -228,8 +228,9 @@ int presence_send_update( struct im_connection *ic )
/* Have to send this update to all groupchats too, the server won't
do this automatically. */
- for( c = ic->groupchats; c && st; c = c->next )
+ for( l = ic->groupchats; l && st; l = l->next )
{
+ struct groupchat *c = l->data;
struct jabber_chat *jc = c->data;
xt_add_attr( node, "to", jc->my_full_jid );
diff --git a/protocols/jabber/s5bytestream.c b/protocols/jabber/s5bytestream.c
index 19d0d81a..a8137271 100644
--- a/protocols/jabber/s5bytestream.c
+++ b/protocols/jabber/s5bytestream.c
@@ -566,7 +566,7 @@ gboolean jabber_bs_recv_handshake_abort( struct bs_transfer *bt, char *error )
imcb_log( tf->ic, "WARNING: Error transmitting bytestream response" );
xt_free_node( reply );
- imcb_file_canceled( tf->ft, "couldn't connect to any streamhosts" );
+ imcb_file_canceled( tf->ic, tf->ft, "couldn't connect to any streamhosts" );
bt->tf->watch_in = 0;
/* MUST always return FALSE! */
@@ -603,7 +603,7 @@ void jabber_bs_recv_answer_request( struct bs_transfer *bt )
xt_add_attr( reply, "id", tf->iq_id );
if( !jabber_write_packet( tf->ic, reply ) )
- imcb_file_canceled( tf->ft, "Error transmitting bytestream response" );
+ imcb_file_canceled( tf->ic, tf->ft, "Error transmitting bytestream response" );
xt_free_node( reply );
}
@@ -643,7 +643,7 @@ gboolean jabber_bs_recv_read( gpointer data, gint fd, b_input_condition cond )
tf->bytesread += ret;
if( tf->bytesread >= tf->ft->file_size )
- imcb_file_finished( tf->ft );
+ imcb_file_finished( tf->ic, tf->ft );
tf->ft->write( tf->ft, tf->ft->buffer, ret );
@@ -659,7 +659,7 @@ gboolean jabber_bs_recv_write_request( file_transfer_t *ft )
if( tf->watch_in )
{
- imcb_file_canceled( ft, "BUG in jabber file transfer: write_request called when already watching for input" );
+ imcb_file_canceled( tf->ic, ft, "BUG in jabber file transfer: write_request called when already watching for input" );
return FALSE;
}
@@ -705,7 +705,7 @@ gboolean jabber_bs_send_write( file_transfer_t *ft, char *buffer, unsigned int l
return jabber_bs_abort( bt, "send() sent %d instead of %d (send buffer too big!)", ret, len );
if( tf->byteswritten >= ft->file_size )
- imcb_file_finished( ft );
+ imcb_file_finished( tf->ic, ft );
else
bt->tf->watch_out = b_input_add( tf->fd, B_EV_IO_WRITE, jabber_bs_send_can_write, bt );
@@ -1005,7 +1005,7 @@ gboolean jabber_bs_send_request( struct jabber_transfer *tf, GSList *streamhosts
jabber_cache_add( tf->ic, iq, jabber_bs_send_handle_reply );
if( !jabber_write_packet( tf->ic, iq ) )
- imcb_file_canceled( tf->ft, "Error transmitting bytestream request" );
+ imcb_file_canceled( tf->ic, tf->ft, "Error transmitting bytestream request" );
return TRUE;
}
@@ -1020,7 +1020,7 @@ gboolean jabber_bs_send_handshake_abort(struct bs_transfer *bt, char *error )
error );
if( jd->streamhosts==NULL ) /* we're done here unless we have a proxy to try */
- imcb_file_canceled( tf->ft, error );
+ imcb_file_canceled( tf->ic, tf->ft, error );
/* MUST always return FALSE! */
return FALSE;
diff --git a/protocols/jabber/si.c b/protocols/jabber/si.c
index bfb64f11..58c0e17f 100644
--- a/protocols/jabber/si.c
+++ b/protocols/jabber/si.c
@@ -90,11 +90,11 @@ int jabber_si_check_features( struct jabber_transfer *tf, GSList *features ) {
}
if( !foundft )
- imcb_file_canceled( tf->ft, "Buddy's client doesn't feature file transfers" );
+ imcb_file_canceled( tf->ic, tf->ft, "Buddy's client doesn't feature file transfers" );
else if( !foundbt )
- imcb_file_canceled( tf->ft, "Buddy's client doesn't feature byte streams (required)" );
+ imcb_file_canceled( tf->ic, tf->ft, "Buddy's client doesn't feature byte streams (required)" );
else if( !foundsi )
- imcb_file_canceled( tf->ft, "Buddy's client doesn't feature stream initiation (required)" );
+ imcb_file_canceled( tf->ic, tf->ft, "Buddy's client doesn't feature stream initiation (required)" );
return foundft && foundbt && foundsi;
}
@@ -108,7 +108,7 @@ void jabber_si_transfer_start( struct jabber_transfer *tf ) {
jabber_si_send_request( tf->ic, tf->bud->full_jid, tf );
/* and start the receive logic */
- imcb_file_recv_start( tf->ft );
+ imcb_file_recv_start( tf->ic, tf->ft );
}
@@ -155,7 +155,7 @@ void jabber_si_transfer_request( struct im_connection *ic, file_transfer_t *ft,
if( bud == NULL )
{
- imcb_file_canceled( ft, "Couldn't find buddy (BUG?)" );
+ imcb_file_canceled( ic, ft, "Couldn't find buddy (BUG?)" );
return;
}