Skip to content

Commit

Permalink
VERSION: updated to 3d30d24fdbef
Browse files Browse the repository at this point in the history
  • Loading branch information
jgeboski committed Aug 12, 2015
1 parent 7443c55 commit 635a32f
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 84 deletions.
19 changes: 19 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
purple-facebook-3d30d24fdbef (2015-08-11):
- Add and alias non-friend buddies
- Added support for all XMA messages
- Depend on autoconf-2.64
- Fixed account information not being set correctly
- Fixed all JSON arrays being required
- Fixed issues and leaks with API error handling
- Fixed several issues with room lists
- Fixed the printing of invalid JSON type names
- Handle group chat events (additions/removals)
- Implemented self messages
- Implemented the invisible presence state
- Implemented the retrieval of unread messages
- Lots of code refactoring
- Removed an extra and unneeded contacts fetch request
- Removed some debugging messages
- Updated GraphQL queries
- Updated the MQTT version to MQTToT

purple-facebook-9e3520d6ec49 (2015-08-05):
- Cleaned up the libpurple includes
- Fixed non-friends being added as buddies
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9e3520d6ec49
3d30d24fdbef
118 changes: 79 additions & 39 deletions include/purple-compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,52 +25,66 @@
#include "prpl.h"
#include "request.h"

typedef struct _PurpleMessage PurpleMessage;

struct _PurpleMessage
{
const gchar *name;
const gchar *text;
PurpleMessageFlags flags;
};

#undef purple_notify_error

#define PurpleChatConversation PurpleConvChat
#define PurpleProtocolChatEntry struct proto_chat_entry
#define PurpleIMTypingState PurpleTypingState
#define PurpleMessage const gchar
#define PurpleProtocol void
#define PurpleChatConversation PurpleConvChat
#define PurpleProtocolChatEntry struct proto_chat_entry
#define PurpleIMConversation PurpleConvIm
#define PurpleIMTypingState PurpleTypingState
#define PurpleProtocol void
#define PurpleRequestCommonParameters void

#define PURPLE_CMD_FLAG_PROTOCOL_ONLY PURPLE_CMD_FLAG_PRPL_ONLY
#define PURPLE_CMD_P_PROTOCOL PURPLE_CMD_P_PRPL
#define PURPLE_CONNECTION_CONNECTED PURPLE_CONNECTED
#define PURPLE_IM_NOT_TYPING PURPLE_NOT_TYPING
#define PURPLE_IM_TYPING PURPLE_TYPING

#define PURPLE_CHAT_CONVERSATION purple_conversation_get_chat_data
#define PURPLE_CONVERSATION purple_conv_chat_get_conversation
#define PURPLE_IS_ACCOUNT(a) ((a) != NULL)
#define PURPLE_IS_BUDDY(b) ((b) != NULL)
#define PURPLE_CMD_P_PROTOCOL PURPLE_CMD_P_PRPL
#define PURPLE_CONNECTION_CONNECTED PURPLE_CONNECTED
#define PURPLE_IM_NOT_TYPING PURPLE_NOT_TYPING
#define PURPLE_IM_TYPING PURPLE_TYPING

#define PURPLE_CHAT_CONVERSATION purple_conversation_get_chat_data
#define PURPLE_CONVERSATION(c) ((c)->conv)
#define PURPLE_IS_ACCOUNT(a) ((a) != NULL)
#define PURPLE_IS_BUDDY(b) ((b) != NULL)
#define PURPLE_IS_CHAT_CONVERSATION(c) ((c) != NULL)
#define PURPLE_IS_CONNECTION(c) ((c) != NULL)

#define purple_account_get_private_alias purple_account_get_alias
#define purple_account_set_private_alias purple_account_set_alias
#define purple_blist_get_default_group() NULL
#define purple_blist_find_buddies purple_find_buddies
#define purple_blist_find_buddy purple_find_buddy
#define purple_buddy_set_server_alias purple_blist_server_alias_buddy
#define purple_chat_conversation_add_user purple_conv_chat_add_user
#define purple_chat_conversation_get_id purple_conv_chat_get_id
#define purple_chat_conversation_has_user purple_conv_chat_find_user
#define purple_chat_conversation_remove_user purple_conv_chat_remove_user
#define purple_chat_conversation_set_topic purple_conv_chat_set_topic
#define purple_connection_error purple_connection_error_reason
#define purple_connection_is_disconnecting(c) FALSE
#define purple_conversation_get_connection purple_conversation_get_gc
#define purple_protocol_got_user_status purple_prpl_got_user_status
#define purple_proxy_info_get_proxy_type purple_proxy_info_get_type
#define PURPLE_IS_CONNECTION(c) ((c) != NULL)

#define purple_account_get_private_alias purple_account_get_alias
#define purple_account_set_private_alias purple_account_set_alias
#define purple_blist_get_default_group() NULL
#define purple_blist_find_buddies purple_find_buddies
#define purple_blist_find_buddy purple_find_buddy
#define purple_blist_find_group purple_find_group
#define purple_buddy_set_server_alias purple_blist_server_alias_buddy
#define purple_chat_conversation_add_user purple_conv_chat_add_user
#define purple_chat_conversation_get_id purple_conv_chat_get_id
#define purple_chat_conversation_has_user purple_conv_chat_find_user
#define purple_chat_conversation_remove_user purple_conv_chat_remove_user
#define purple_chat_conversation_set_topic purple_conv_chat_set_topic
#define purple_connection_error purple_connection_error_reason
#define purple_connection_is_disconnecting(c) FALSE
#define purple_conversation_get_connection purple_conversation_get_gc
#define purple_message_get_contents(m) ((m)->text)
#define purple_message_get_flags(m) ((m)->flags)
#define purple_message_get_recipient(m) ((m)->name)
#define purple_protocol_got_user_status purple_prpl_got_user_status
#define purple_proxy_info_get_proxy_type purple_proxy_info_get_type
#define purple_request_cpar_from_connection(c) NULL
#define purple_roomlist_get_account(l) ((l)->account)
#define purple_serv_got_chat_in serv_got_chat_in
#define purple_serv_got_chat_left serv_got_chat_left
#define purple_serv_got_im serv_got_im
#define purple_serv_got_typing serv_got_typing
#define purple_serv_got_typing_stopped serv_got_typing_stopped
#define purple_serv_join_chat serv_join_chat
#define purple_roomlist_get_account(l) ((l)->account)
#define purple_serv_got_chat_in serv_got_chat_in
#define purple_serv_got_chat_left serv_got_chat_left
#define purple_serv_got_im serv_got_im
#define purple_serv_got_typing serv_got_typing
#define purple_serv_got_typing_stopped serv_got_typing_stopped
#define purple_serv_join_chat serv_join_chat
#define purple_status_get_status_type purple_status_get_type

#define purple_conversations_find_chat(c, i) \
purple_conversation_get_chat_data( \
Expand All @@ -82,6 +96,22 @@
purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, n, a) \
)

#define purple_conversations_find_im_with_account(n, a) \
purple_conversation_get_im_data( \
purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, n, a) \
)

#define purple_conversation_write_message(c, m) \
purple_conversation_write(c, (m)->name, (m)->text, (m)->flags, 0);

#define purple_im_conversation_new(a, n) \
purple_conversation_get_im_data( \
purple_conversation_new(PURPLE_CONV_TYPE_IM, a, n) \
)

#define purple_message_new_outgoing(n, t, f) \
((PurpleMessage *) &((PurpleMessage) {n, t, f}))

#define purple_notify_error(h, t, p, s, c) \
purple_notify_message(h, PURPLE_NOTIFY_MSG_ERROR, t, p, s, NULL, NULL)

Expand All @@ -93,4 +123,14 @@
serv_got_joined_chat(c, i, n) \
)

static inline void
purple_blist_node_set_transient(PurpleBlistNode *node, gboolean transient)
{
if (transient) {
node->flags |= PURPLE_BLIST_NODE_FLAG_NO_SAVE;
} else {
node->flags &= ~PURPLE_BLIST_NODE_FLAG_NO_SAVE;
}
}

#endif /* _PURPLE_COMPAT_H_ */
83 changes: 39 additions & 44 deletions patches/02-plugin.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
--- a/libpurple/protocols/facebook/facebook.c Wed Aug 05 17:57:33 2015 -0400
+++ b/libpurple/protocols/facebook/facebook.c Wed Aug 05 19:21:33 2015 -0400
@@ -461,7 +461,7 @@
diff -r 3d30d24fdbef libpurple/protocols/facebook/facebook.c
--- a/libpurple/protocols/facebook/facebook.c Tue Aug 11 19:33:09 2015 -0400
+++ b/libpurple/protocols/facebook/facebook.c Tue Aug 11 19:56:11 2015 -0400
@@ -615,7 +615,7 @@
GSList *select = NULL;
PurpleConnection *gc;

Expand All @@ -10,7 +10,7 @@ diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
return;
}

@@ -628,7 +628,7 @@
@@ -794,7 +794,7 @@
PurpleConnection *gc;
PurpleMenuAction *act;

Expand All @@ -19,59 +19,45 @@ diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
return NULL;
}

@@ -651,7 +651,8 @@
@@ -842,7 +842,8 @@
}

static gint
-fb_im_send(PurpleConnection *gc, PurpleMessage *msg)
+fb_im_send(PurpleConnection *gc, const gchar *who, const gchar *msg,
+fb_im_send(PurpleConnection *gc, const gchar *who, const gchar *tmsg,
+ PurpleMessageFlags flags)
{
const gchar *name;
const gchar *text;
@@ -663,10 +664,10 @@
@@ -851,6 +852,8 @@
FbId uid;
gchar *sext;

+ PurpleMessage *msg = purple_message_new_outgoing(who, tmsg, flags);
+
fata = purple_connection_get_protocol_data(gc);
api = fb_data_get_api(fata);

- name = purple_message_get_recipient(msg);
+ name = who;
uid = FB_ID_FROM_STR(name);

- text = purple_message_get_contents(msg);
+ text = msg;
sext = purple_markup_strip_html(text);
fb_api_message(api, uid, FALSE, sext);
g_free(sext);
@@ -788,7 +789,8 @@
@@ -978,7 +981,8 @@
}

static gint
-fb_chat_send(PurpleConnection *gc, gint id, PurpleMessage *msg)
+fb_chat_send(PurpleConnection *gc, gint id, const gchar *msg,
+fb_chat_send(PurpleConnection *gc, gint id, const gchar *tmsg,
+ PurpleMessageFlags flags)
{
const gchar *name;
const gchar *text;
@@ -807,15 +809,15 @@
name = purple_conversation_get_name(PURPLE_CONVERSATION(chat));
tid = FB_ID_FROM_STR(name);

- text = purple_message_get_contents(msg);
+ text = msg;
sext = purple_markup_strip_html(text);
fb_api_message(api, tid, TRUE, sext);
g_free(sext);
@@ -989,6 +993,8 @@
PurpleAccount *acct;
PurpleChatConversation *chat;

name = purple_account_get_username(acct);
purple_serv_got_chat_in(gc, id, name,
- purple_message_get_flags(msg),
- purple_message_get_contents(msg),
+ flags,
+ msg,
time(NULL));
return 0;
}
@@ -969,99 +971,6 @@
+ PurpleMessage *msg = purple_message_new_outgoing(NULL, tmsg, flags);
+
acct = purple_connection_get_account(gc);
fata = purple_connection_get_protocol_data(gc);
api = fb_data_get_api(fata);
@@ -1162,103 +1168,6 @@
}

static void
Expand All @@ -88,6 +74,10 @@ diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
- "mark-read", TRUE);
- opts = g_list_prepend(opts, opt);
-
- opt = purple_account_option_bool_new(_("Show unread messages"),
- "show-unread", TRUE);
- opts = g_list_prepend(opts, opt);
-
- opt = purple_account_option_bool_new(_("Open new group chats with "
- "incoming messages"),
- "group-chat-open", TRUE);
Expand Down Expand Up @@ -115,7 +105,7 @@ diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
-static void
-facebook_protocol_server_iface_init(PurpleProtocolServerIface *iface)
-{
-
- iface->set_status = fb_server_set_status;
-}
-
-static void
Expand Down Expand Up @@ -171,7 +161,7 @@ diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
fb_cmds_register(void)
{
PurpleCmdId id;
@@ -1073,13 +982,13 @@
@@ -1270,13 +1179,13 @@
g_return_if_fail(fb_cmds == NULL);

id = purple_cmd_register("kick", "s", PURPLE_CMD_P_PROTOCOL, cflags,
Expand All @@ -187,7 +177,7 @@ diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
_("leave: Leave the chat"),
NULL);
fb_cmds = g_slist_prepend(fb_cmds, GUINT_TO_POINTER(id));
@@ -1098,43 +1007,92 @@
@@ -1295,43 +1204,97 @@
g_slist_free_full(fb_cmds, fb_cmds_unregister_free);
}

Expand Down Expand Up @@ -287,6 +277,7 @@ diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
+ pinfo.close = fb_close;
+ pinfo.send_im = fb_im_send;
+ pinfo.send_typing = fb_im_send_typing;
+ pinfo.set_status = fb_server_set_status;
+ pinfo.join_chat = fb_chat_join;
+ pinfo.get_chat_name = fb_chat_get_name;
+ pinfo.chat_invite = fb_chat_invite;
Expand All @@ -301,6 +292,10 @@ diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
+ "mark-read", TRUE);
+ opts = g_list_prepend(opts, opt);
+
+ opt = purple_account_option_bool_new(_("Show unread messages"),
+ "show-unread", TRUE);
+ opts = g_list_prepend(opts, opt);
+
+ opt = purple_account_option_bool_new(_("Open new group chats with "
+ "incoming messages"),
+ "group-chat-open", TRUE);
Expand All @@ -310,9 +305,9 @@ diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.c
+ inited = TRUE;
+ return purple_plugin_register(plugin);
+}
diff -r 9e3520d6ec49 libpurple/protocols/facebook/facebook.h
--- a/libpurple/protocols/facebook/facebook.h Wed Aug 05 17:57:33 2015 -0400
+++ b/libpurple/protocols/facebook/facebook.h Wed Aug 05 19:21:33 2015 -0400
diff -r 3d30d24fdbef libpurple/protocols/facebook/facebook.h
--- a/libpurple/protocols/facebook/facebook.h Tue Aug 11 19:33:09 2015 -0400
+++ b/libpurple/protocols/facebook/facebook.h Tue Aug 11 19:56:11 2015 -0400
@@ -24,29 +24,4 @@

#include <glib.h>
Expand Down

0 comments on commit 635a32f

Please sign in to comment.