diff options
author | Ankit Vani <a@nevitus.org> | 2013-08-22 01:35:32 +0530 |
---|---|---|
committer | Ankit Vani <a@nevitus.org> | 2013-08-22 01:35:32 +0530 |
commit | f30f5667daa327c86ae481816fc516d6833f86e7 (patch) | |
tree | c95a3d4675c8ebe44fdd2ef71bc7cdd8eaade097 /libpurple/protocols/bonjour/jabber.c | |
parent | 836575deafeb881a6c984146be7ccb62e40561c0 (diff) | |
parent | 24eb25e1d7eeba87abf49e997674459b43c994e6 (diff) | |
download | pidgin-f30f5667daa327c86ae481816fc516d6833f86e7.tar.gz |
Merged default branch
Diffstat (limited to 'libpurple/protocols/bonjour/jabber.c')
-rw-r--r-- | libpurple/protocols/bonjour/jabber.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c index a600b6d023..241abf16be 100644 --- a/libpurple/protocols/bonjour/jabber.c +++ b/libpurple/protocols/bonjour/jabber.c @@ -52,7 +52,7 @@ #include "network.h" #include "eventloop.h" #include "connection.h" -#include "blist.h" +#include "buddylist.h" #include "xmlnode.h" #include "debug.h" #include "notify.h" @@ -89,7 +89,7 @@ bonjour_jabber_conv_new(PurpleBuddy *pb, PurpleAccount *account, const char *ip) BonjourJabberConversation *bconv = g_new0(BonjourJabberConversation, 1); bconv->socket = -1; - bconv->tx_buf = purple_circ_buffer_new(512); + bconv->tx_buf = purple_circular_buffer_new(512); bconv->tx_handler = 0; bconv->rx_handler = 0; bconv->pb = pb; @@ -280,7 +280,7 @@ _send_data_write_cb(gpointer data, gint source, PurpleInputCondition cond) BonjourJabberConversation *bconv = bb->conversation; int ret, writelen; - writelen = purple_circ_buffer_get_max_read(bconv->tx_buf); + writelen = purple_circular_buffer_get_max_read(bconv->tx_buf); if (writelen == 0) { purple_input_remove(bconv->tx_handler); @@ -288,7 +288,7 @@ _send_data_write_cb(gpointer data, gint source, PurpleInputCondition cond) return; } - ret = send(bconv->socket, bconv->tx_buf->outptr, writelen, 0); + ret = send(bconv->socket, purple_circular_buffer_get_output(bconv->tx_buf), writelen, 0); if (ret < 0 && errno == EAGAIN) return; @@ -302,7 +302,7 @@ _send_data_write_cb(gpointer data, gint source, PurpleInputCondition cond) account = purple_buddy_get_account(pb); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); + conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bb->name, account)); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send message."), @@ -313,7 +313,7 @@ _send_data_write_cb(gpointer data, gint source, PurpleInputCondition cond) return; } - purple_circ_buffer_mark_read(bconv->tx_buf, ret); + purple_circular_buffer_mark_read(bconv->tx_buf, ret); } static gint @@ -329,7 +329,7 @@ _send_data(PurpleBuddy *pb, char *message) || bconv->connect_data != NULL || bconv->sent_stream_start != FULLY_SENT || !bconv->recv_stream_start - || purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { + || purple_circular_buffer_get_max_read(bconv->tx_buf) > 0) { ret = -1; errno = EAGAIN; } else { @@ -348,7 +348,7 @@ _send_data(PurpleBuddy *pb, char *message) account = purple_buddy_get_account(pb); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); + conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bb->name, account)); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send message."), @@ -364,7 +364,7 @@ _send_data(PurpleBuddy *pb, char *message) if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start && bconv->tx_handler == 0) bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, _send_data_write_cb, pb); - purple_circ_buffer_append(bconv->tx_buf, message + ret, len - ret); + purple_circular_buffer_append(bconv->tx_buf, message + ret, len - ret); } return ret; @@ -396,7 +396,7 @@ static void bonjour_jabber_stream_ended(BonjourJabberConversation *bconv) { #if 0 if(bconv->pb != NULL) { PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bconv->pb->name, bconv->pb->account); + conv = purple_conversations_find_im_with_account(bconv->pb->name, bconv->pb->account); if (conv != NULL) { char *tmp = g_strdup_printf(_("%s has closed the conversation."), bconv->pb->name); purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); @@ -485,7 +485,7 @@ _start_stream(gpointer data, gint source, PurpleInputCondition condition) purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", bname ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); + conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bname, bconv->account)); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send the message, the conversation couldn't be started."), @@ -550,7 +550,7 @@ static gboolean bonjour_jabber_send_stream_init(BonjourJabberConversation *bconv if (bconv->pb) { PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); + conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bname, bconv->account)); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send the message, the conversation couldn't be started."), @@ -595,7 +595,7 @@ void bonjour_jabber_stream_started(BonjourJabberConversation *bconv) { if (bconv->pb) { PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); + conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bname, bconv->account)); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send the message, the conversation couldn't be started."), @@ -616,7 +616,7 @@ void bonjour_jabber_stream_started(BonjourJabberConversation *bconv) { /* If the stream has been completely started and we know who we're talking to, we can start doing stuff. */ /* I don't think the circ_buffer can actually contain anything without a buddy being associated, but lets be explicit. */ if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start - && bconv->pb && purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { + && bconv->pb && purple_circular_buffer_get_max_read(bconv->tx_buf) > 0) { /* Watch for when we can write the buffered messages */ bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, _send_data_write_cb, bconv->pb); @@ -680,7 +680,7 @@ _server_socket_handler(gpointer data, int server_socket, PurpleInputCondition co mbba = g_new0(struct _match_buddies_by_address_t, 1); mbba->address = address_text; - buddies = purple_find_buddies(jdata->account, NULL); + buddies = purple_blist_find_buddies(jdata->account, NULL); g_slist_foreach(buddies, _match_buddies_by_address, mbba); g_slist_free(buddies); @@ -872,7 +872,7 @@ _connected_to_buddy(gpointer data, gint source, const gchar *error) purple_debug_error("bonjour", "No more addresses for buddy %s. Aborting", purple_buddy_get_name(pb)); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); + conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bb->name, account)); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send the message, the conversation couldn't be started."), @@ -893,7 +893,7 @@ _connected_to_buddy(gpointer data, gint source, const gchar *error) account = purple_buddy_get_account(pb); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); + conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bb->name, account)); if (conv != NULL) purple_conversation_write(conv, NULL, _("Unable to send the message, the conversation couldn't be started."), @@ -919,7 +919,7 @@ bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { g_return_if_fail(bconv->ip != NULL); g_return_if_fail(bconv->pb == NULL); - pb = purple_find_buddy(bconv->account, bconv->buddy_name); + pb = purple_blist_find_buddy(bconv->account, bconv->buddy_name); if (pb && (bb = purple_buddy_get_protocol_data(pb))) { const char *ip; GSList *tmp = bb->ips; @@ -975,7 +975,7 @@ bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { mbba = g_new0(struct _match_buddies_by_address_t, 1); mbba->address = bconv->ip; - buddies = purple_find_buddies(jdata->account, NULL); + buddies = purple_blist_find_buddies(jdata->account, NULL); g_slist_foreach(buddies, _match_buddies_by_address, mbba); g_slist_free(buddies); @@ -1024,7 +1024,7 @@ _find_or_start_conversation(BonjourJabber *jdata, const gchar *to) g_return_val_if_fail(jdata != NULL, NULL); g_return_val_if_fail(to != NULL, NULL); - pb = purple_find_buddy(jdata->account, to); + pb = purple_blist_find_buddy(jdata->account, to); if (pb == NULL || (bb = purple_buddy_get_protocol_data(pb)) == NULL) /* You can not send a message to an offline buddy */ return NULL; @@ -1189,7 +1189,7 @@ bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) purple_input_remove(bconv->tx_handler); /* Free all the data related to the conversation */ - purple_circ_buffer_destroy(bconv->tx_buf); + g_object_unref(G_OBJECT(bconv->tx_buf)); if (bconv->connect_data != NULL) purple_proxy_connect_cancel(bconv->connect_data); if (bconv->stream_data != NULL) { @@ -1227,12 +1227,12 @@ bonjour_jabber_stop(BonjourJabber *jdata) if (!purple_account_is_disconnected(jdata->account)) { GSList *buddies, *l; - buddies = purple_find_buddies(jdata->account, NULL); + buddies = purple_blist_find_buddies(jdata->account, NULL); for (l = buddies; l; l = l->next) { BonjourBuddy *bb = purple_buddy_get_protocol_data((PurpleBuddy*) l->data); if (bb && bb->conversation) { /* Any ongoing connection attempt is cancelled - * by _purple_connection_destroy */ + * when a connection is destroyed */ bb->conversation->connect_data = NULL; bonjour_jabber_close_conversation(bb->conversation); bb->conversation = NULL; @@ -1303,7 +1303,7 @@ check_if_blocked(PurpleBuddy *pb) acc = purple_buddy_get_account(pb); - for(l = acc->deny; l != NULL; l = l->next) { + for(l = purple_account_privacy_get_denied(acc); l != NULL; l = l->next) { const gchar *name = purple_buddy_get_name(pb); const gchar *username = bonjour_get_jid(acc); |