Mercurial > pidgin.yaz
diff libpurple/protocols/oscar/odc.c @ 15823:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 5fe8042783c1 |
children | 391a79778f89 |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/odc.c Mon Mar 19 06:11:46 2007 +0000 +++ b/libpurple/protocols/oscar/odc.c Mon Mar 19 07:01:17 2007 +0000 @@ -1,5 +1,5 @@ /* - * Gaim's oscar protocol plugin + * Purple's oscar protocol plugin * This file is the legal property of its developers. * Please see the AUTHORS file distributed alongside this file. * @@ -22,7 +22,7 @@ #include "oscar.h" #include "peer.h" -/* From Gaim */ +/* From Purple */ #include "conversation.h" #include "imgstore.h" #include "util.h" @@ -56,12 +56,12 @@ if (tmp != NULL) { - GaimAccount *account; - GaimConversation *conv; + PurpleAccount *account; + PurpleConversation *conv; - account = gaim_connection_get_account(conn->od->gc); - conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, conn->sn); - gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); + account = purple_connection_get_account(conn->od->gc); + conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->sn); + purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); g_free(tmp); } @@ -81,17 +81,17 @@ static void peer_odc_send(PeerConnection *conn, OdcFrame *frame) { - GaimAccount *account; + PurpleAccount *account; const char *username; size_t length; ByteStream bs; - gaim_debug_info("oscar", "Outgoing ODC frame to %s with " + purple_debug_info("oscar", "Outgoing ODC frame to %s with " "type=0x%04x, flags=0x%04x, payload length=%u\n", conn->sn, frame->type, frame->flags, frame->payload.len); - account = gaim_connection_get_account(conn->od->gc); - username = gaim_account_get_username(account); + account = purple_connection_get_account(conn->od->gc); + username = purple_account_get_username(account); memcpy(frame->sn, username, strlen(username)); memcpy(frame->cookie, conn->cookie, 8); @@ -146,16 +146,16 @@ * Send client-to-client typing notification over an established direct connection. */ void -peer_odc_send_typing(PeerConnection *conn, GaimTypingState typing) +peer_odc_send_typing(PeerConnection *conn, PurpleTypingState typing) { OdcFrame frame; memset(&frame, 0, sizeof(OdcFrame)); frame.type = 0x0001; frame.subtype = 0x0006; - if (typing == GAIM_TYPING) + if (typing == PURPLE_TYPING) frame.flags = 0x0002 | 0x0008; - else if (typing == GAIM_TYPED) + else if (typing == PURPLE_TYPED) frame.flags = 0x0002 | 0x0004; else frame.flags = 0x0002; @@ -209,7 +209,7 @@ * This function rips out all the data chunks and creates an imgstore for * each one. In order to do this, it first goes through the IM and takes * out all the IMG tags. When doing so, it rewrites the original IMG tag - * with one compatible with the imgstore Gaim core code. For each one, we + * with one compatible with the imgstore Purple core code. For each one, we * then read in chunks of data from the end of the message and actually * create the img store using the given data. * @@ -233,8 +233,8 @@ static void peer_odc_handle_payload(PeerConnection *conn, const char *msg, size_t len, int encoding, gboolean autoreply) { - GaimConnection *gc; - GaimAccount *account; + PurpleConnection *gc; + PurpleAccount *account; const char *msgend, *binary_start, *dataend; const char *tmp, *start, *end, *idstr, *src, *sizestr; GData *attributes; @@ -243,10 +243,10 @@ GSList *images; gchar *utf8; GString *newmsg; - GaimMessageFlags imflags; + PurpleMessageFlags imflags; gc = conn->od->gc; - account = gaim_connection_get_account(gc); + account = purple_connection_get_account(gc); dataend = msg + len; @@ -264,7 +264,7 @@ * parsing it, and the local user will see broken image icons. */ /* TODO: Use a length argument when looking for the <binary> tag! */ - binary_start = gaim_strcasestr(msg, "<binary>"); + binary_start = purple_strcasestr(msg, "<binary>"); if (binary_start == NULL) msgend = dataend; else @@ -277,7 +277,7 @@ /* The embedded binary markup has a mimimum length of 29 bytes */ /* TODO: Use a length argument when looking for the <data> tag! */ while ((tmp + 29 <= dataend) && - gaim_markup_find_tag("data", tmp, &start, &tmp, &attributes)) + purple_markup_find_tag("data", tmp, &start, &tmp, &attributes)) { unsigned int id; size_t size; @@ -328,12 +328,12 @@ /* * Loop through the message, replacing OSCAR img tags with the - * equivalent Gaim img tag. + * equivalent Purple img tag. */ images = NULL; newmsg = g_string_new(""); tmp = msg; - while (gaim_markup_find_tag("img", tmp, &start, &end, &attributes)) + while (purple_markup_find_tag("img", tmp, &start, &end, &attributes)) { int imgid = 0; @@ -353,7 +353,7 @@ if ((embedded_data != NULL) && (embedded_data->size == size)) { - imgid = gaim_imgstore_add(embedded_data->data, size, src); + imgid = purple_imgstore_add(embedded_data->data, size, src); /* Record the image number */ images = g_slist_append(images, GINT_TO_POINTER(imgid)); @@ -364,7 +364,7 @@ g_datalist_clear(&attributes); /* Append the message up to the tag */ - utf8 = gaim_plugin_oscar_decode_im_part(account, conn->sn, + utf8 = purple_plugin_oscar_decode_im_part(account, conn->sn, encoding, 0x0000, tmp, start - tmp); if (utf8 != NULL) { g_string_append(newmsg, utf8); @@ -384,7 +384,7 @@ /* Append any remaining message data */ if (tmp <= msgend) { - utf8 = gaim_plugin_oscar_decode_im_part(account, conn->sn, + utf8 = purple_plugin_oscar_decode_im_part(account, conn->sn, encoding, 0x0000, tmp, msgend - tmp); if (utf8 != NULL) { g_string_append(newmsg, utf8); @@ -395,9 +395,9 @@ /* Send the message */ imflags = 0; if (images != NULL) - imflags |= GAIM_MESSAGE_IMAGES; + imflags |= PURPLE_MESSAGE_IMAGES; if (autoreply) - imflags |= GAIM_MESSAGE_AUTO_RESP; + imflags |= PURPLE_MESSAGE_AUTO_RESP; serv_got_im(gc, conn->sn, newmsg->str, imflags, time(NULL)); g_string_free(newmsg, TRUE); @@ -406,7 +406,7 @@ { GSList *l; for (l = images; l != NULL; l = l->next) - gaim_imgstore_unref(GPOINTER_TO_INT(l->data)); + purple_imgstore_unref(GPOINTER_TO_INT(l->data)); g_slist_free(images); } @@ -415,7 +415,7 @@ } /** - * This is a gaim_input_add() watcher callback function for reading + * This is a purple_input_add() watcher callback function for reading * direct IM payload data. "Payload data" is always an IM and * maybe some embedded images or files or something. The actual * ODC frame is read using peer_connection_recv_cb(). We temporarily @@ -423,7 +423,7 @@ * switch back once we're done. */ static void -peer_odc_recv_cb(gpointer data, gint source, GaimInputCondition cond) +peer_odc_recv_cb(gpointer data, gint source, PurpleInputCondition cond) { PeerConnection *conn; OdcFrame *frame; @@ -472,9 +472,9 @@ g_free(frame); conn->frame = NULL; - gaim_input_remove(conn->watcher_incoming); - conn->watcher_incoming = gaim_input_add(conn->fd, - GAIM_INPUT_READ, peer_connection_recv_cb, conn); + purple_input_remove(conn->watcher_incoming); + conn->watcher_incoming = purple_input_add(conn->fd, + PURPLE_INPUT_READ, peer_connection_recv_cb, conn); } /** @@ -485,7 +485,7 @@ void peer_odc_recv_frame(PeerConnection *conn, ByteStream *bs) { - GaimConnection *gc; + PurpleConnection *gc; OdcFrame *frame; gc = conn->od->gc; @@ -503,7 +503,7 @@ byte_stream_advance(bs, 4); byte_stream_getrawbuf(bs, frame->sn, 32); - gaim_debug_info("oscar", "Incoming ODC frame from %s with " + purple_debug_info("oscar", "Incoming ODC frame from %s with " "type=0x%04x, flags=0x%04x, payload length=%u\n", frame->sn, frame->type, frame->flags, frame->payload.len); @@ -514,8 +514,8 @@ * connected to our friend and not a malicious middle man. */ - GaimAccount *account; - GaimConversation *conv; + PurpleAccount *account; + PurpleConversation *conv; if (conn->flags & PEER_CONNECTION_FLAG_IS_INCOMING) { @@ -526,7 +526,7 @@ * the correct cookie! They are not our friend. Go try * to accept another connection? */ - gaim_debug_info("oscar", "Received an incorrect cookie. " + purple_debug_info("oscar", "Received an incorrect cookie. " "Closing connection.\n"); peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA, NULL); @@ -555,15 +555,15 @@ } /* Tell the local user that we are connected */ - account = gaim_connection_get_account(gc); - conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, conn->sn); - gaim_conversation_write(conv, NULL, _("Direct IM established"), - GAIM_MESSAGE_SYSTEM, time(NULL)); + account = purple_connection_get_account(gc); + conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->sn); + purple_conversation_write(conv, NULL, _("Direct IM established"), + PURPLE_MESSAGE_SYSTEM, time(NULL)); } if ((frame->type != 0x0001) && (frame->subtype != 0x0006)) { - gaim_debug_info("oscar", "Unknown ODC frame type 0x%04hx, " + purple_debug_info("oscar", "Unknown ODC frame type 0x%04hx, " "subtype 0x%04hx.\n", frame->type, frame->subtype); return; } @@ -571,14 +571,14 @@ if (frame->flags & 0x0008) { /* I had to leave this. It's just too funny. It reminds me of my sister. */ - gaim_debug_info("oscar", "ohmigod! %s has started typing " + purple_debug_info("oscar", "ohmigod! %s has started typing " "(DirectIM). He's going to send you a message! " "*squeal*\n", conn->sn); - serv_got_typing(gc, conn->sn, 0, GAIM_TYPING); + serv_got_typing(gc, conn->sn, 0, PURPLE_TYPING); } else if (frame->flags & 0x0004) { - serv_got_typing(gc, conn->sn, 0, GAIM_TYPED); + serv_got_typing(gc, conn->sn, 0, PURPLE_TYPED); } else { @@ -591,9 +591,9 @@ frame->payload.data = g_new(guint8, frame->payload.len); frame->payload.offset = 0; conn->frame = frame; - gaim_input_remove(conn->watcher_incoming); - conn->watcher_incoming = gaim_input_add(conn->fd, - GAIM_INPUT_READ, peer_odc_recv_cb, conn); + purple_input_remove(conn->watcher_incoming); + conn->watcher_incoming = purple_input_add(conn->fd, + PURPLE_INPUT_READ, peer_odc_recv_cb, conn); return; }