/soc/2012/tomkiewicz/gg: a6356adbe365: Gadu-Gadu: initial multil...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Tue Aug 7 14:25:08 EDT 2012


Changeset: a6356adbe3654140b281c4cbdd8ff13e43b4fcef
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2012-08-07 20:23 +0200
Branch:	 soc.2012.gg
URL: http://hg.pidgin.im/soc/2012/tomkiewicz/gg/rev/a6356adbe365

Description:

Gadu-Gadu: initial multilogon support (2)

diffstat:

 libpurple/protocols/gg/multilogon.c |  65 +++++++++++++++++++++++++++++++++++++
 libpurple/protocols/gg/multilogon.h |  18 ++++++++++
 2 files changed, 83 insertions(+), 0 deletions(-)

diffs (93 lines):

diff --git a/libpurple/protocols/gg/multilogon.c b/libpurple/protocols/gg/multilogon.c
new file mode 100644
--- /dev/null
+++ b/libpurple/protocols/gg/multilogon.c
@@ -0,0 +1,65 @@
+#include "multilogon.h"
+
+#include <debug.h>
+
+#include "gg.h"
+
+struct _ggp_multilogon_session_data
+{
+	int session_count;
+};
+
+static inline ggp_multilogon_session_data *
+ggp_multilogon_get_mldata(PurpleConnection *gc);
+
+////////////
+
+static inline ggp_multilogon_session_data *
+ggp_multilogon_get_mldata(PurpleConnection *gc)
+{
+	GGPInfo *accdata = purple_connection_get_protocol_data(gc);
+	return accdata->multilogon_data;
+}
+
+void ggp_multilogon_setup(PurpleConnection *gc)
+{
+	GGPInfo *accdata = purple_connection_get_protocol_data(gc);
+	
+	ggp_multilogon_session_data *mldata = g_new0(ggp_multilogon_session_data, 1);
+	accdata->multilogon_data = mldata;
+}
+
+void ggp_multilogon_cleanup(PurpleConnection *gc)
+{
+	ggp_multilogon_session_data *mldata = ggp_multilogon_get_mldata(gc);
+	g_free(mldata);
+}
+
+void ggp_multilogon_msg(PurpleConnection *gc, struct gg_event_msg *msg)
+{
+	ggp_recv_message_handler(gc, msg, TRUE);
+}
+
+void ggp_multilogon_info(PurpleConnection *gc,
+	struct gg_event_multilogon_info *info)
+{
+	ggp_multilogon_session_data *mldata = ggp_multilogon_get_mldata(gc);
+	int i;
+	
+	purple_debug_info("gg", "ggp_multilogon_info: session list changed\n");
+	for (i = 0; i < info->count; i++)
+	{
+		purple_debug_misc("gg", "ggp_multilogon_info: "
+			"session [%s] logged in at %lu\n",
+			info->sessions[i].name,
+			info->sessions[i].logon_time);
+	}
+
+	mldata->session_count = info->count;
+}
+
+int ggp_multilogon_get_session_count(PurpleConnection *gc)
+{
+	ggp_multilogon_session_data *mldata = ggp_multilogon_get_mldata(gc);
+	return mldata->session_count;
+}
diff --git a/libpurple/protocols/gg/multilogon.h b/libpurple/protocols/gg/multilogon.h
new file mode 100644
--- /dev/null
+++ b/libpurple/protocols/gg/multilogon.h
@@ -0,0 +1,18 @@
+#ifndef _GGP_MULTILOGON_H
+#define _GGP_MULTILOGON_H
+
+#include <internal.h>
+#include <libgadu.h>
+
+typedef struct _ggp_multilogon_session_data ggp_multilogon_session_data;
+
+void ggp_multilogon_setup(PurpleConnection *gc);
+void ggp_multilogon_cleanup(PurpleConnection *gc);
+
+void ggp_multilogon_msg(PurpleConnection *gc, struct gg_event_msg *msg);
+void ggp_multilogon_info(PurpleConnection *gc,
+	struct gg_event_multilogon_info *msg);
+
+int ggp_multilogon_get_session_count(PurpleConnection *gc);
+
+#endif /* _GGP_MULTILOGON_H */



More information about the Commits mailing list