/soc/2015/nakulgulati/main: 932936a91ad5: Initial Hangouts proto...
Nakul Gulati
nakgulati at gmail.com
Mon Jun 8 03:59:49 EDT 2015
Changeset: 932936a91ad54ac460c955a772aad3fd239f3717
Author: Nakul Gulati <nakgulati at gmail.com>
Date: 2015-06-08 15:59 +0800
Branch: default
URL: https://hg.pidgin.im/soc/2015/nakulgulati/main/rev/932936a91ad5
Description:
Initial Hangouts protocol.
diffstat:
libpurple/protocols/hangouts/hangouts.c | 161 ++++++++++++++++++++++++++++++++
libpurple/protocols/hangouts/hangouts.h | 52 ++++++++++
2 files changed, 213 insertions(+), 0 deletions(-)
diffs (225 lines):
diff --git a/libpurple/protocols/hangouts/hangouts.c b/libpurple/protocols/hangouts/hangouts.c
new file mode 100644
--- /dev/null
+++ b/libpurple/protocols/hangouts/hangouts.c
@@ -0,0 +1,161 @@
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#include "internal.h"
+
+#include "account.h"
+#include "connection.h"
+#include "plugins.h"
+#include "protocol.h"
+#include "protocols.h"
+#include "roomlist.h"
+#include "version.h"
+
+#include "hangouts.h"
+
+static PurpleProtocol *my_protocol = NULL;
+
+static void
+hangouts_login(PurpleAccount *acct)
+{
+
+}
+
+static void
+hangouts_close(PurpleConnection *gc)
+{
+
+}
+
+static GList *
+hangouts_status_types(PurpleAccount *acct)
+{
+ return NULL;
+}
+
+static const char *
+hangouts_list_icon(PurpleAccount *account, PurpleBuddy *buddy)
+{
+ return "hangouts";
+}
+
+static void
+hangouts_protocol_init(PurpleProtocol *protocol)
+{
+ protocol->id = "prpl-hangouts";
+ protocol->name = "Hangouts";
+}
+
+static void
+hangouts_protocol_class_init(PurpleProtocolClass *klass)
+{
+ klass->login = fb_login;
+ klass->close = fb_close;
+ klass->status_types = fb_status_types;
+ klass->list_icon = fb_list_icon;
+}
+
+static void
+hangouts_protocol_client_iface_init(PurpleProtocolClientIface *client_iface)
+{
+
+}
+
+static void
+hangouts_protocol_server_iface_init(PurpleProtocolServerIface *server_iface)
+{
+
+}
+
+static void
+hangouts_protocol_im_iface_init(PurpleProtocolIMIface *im_iface)
+{
+
+}
+
+static void
+hangouts_protocol_chat_iface_init(PurpleProtocolChatIface *chat_iface)
+{
+
+}
+
+static void
+hangouts_protocol_privacy_iface_init(PurpleProtocolPrivacyIface *privacy_iface)
+{
+
+}
+
+static void
+hangouts_protocol_roomlist_iface_init(PurpleProtocolRoomlistIface *roomlist_iface)
+{
+
+}
+
+PURPLE_DEFINE_TYPE_EXTENDED(
+ HangoutsProtocol, hangouts_protocol, PURPLE_TYPE_PROTOCOL, 0,
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CLIENT_IFACE,
+ hangouts_protocol_client_iface_init)
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_SERVER_IFACE,
+ hangouts_protocol_server_iface_init)
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_IM_IFACE,
+ hangouts_protocol_im_iface_init)
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CHAT_IFACE,
+ hangouts_protocol_chat_iface_init)
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_PRIVACY_IFACE,
+ hangouts_protocol_privacy_iface_init)
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_ROOMLIST_IFACE,
+ hangouts_protocol_roomlist_iface_init)
+);
+
+static PurplePluginInfo *
+plugin_query(GError **error)
+{
+ return purple_plugin_info_new(
+ "id", "prpl-hangouts",
+ "name", "Hangouts Protocol",
+ "version", DISPLAY_VERSION,
+ "category", N_("Protocol"),
+ "summary", N_("Hangouts Protocol Plugin"),
+ "description", N_("Hangouts Protocol Plugin"),
+ "website", PURPLE_WEBSITE,
+ "abi-version", PURPLE_ABI_VERSION,
+ "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL |
+ PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD,
+ NULL
+ );
+}
+
+static gboolean
+plugin_load(PurplePlugin *plugin, GError **error)
+{
+ hangouts_protocol_register_type(plugin);
+ my_protocol = purple_protocols_add(HANGOUTS_TYPE_PROTOCOL, error);
+ return my_protocol != NULL;
+}
+
+static gboolean
+plugin_unload(PurplePlugin *plugin, GError **error)
+{
+ return purple_protocols_remove(my_protocol, error);
+}
+
+PURPLE_PLUGIN_INIT(hangouts, plugin_query, plugin_load, plugin_unload);
\ No newline at end of file
diff --git a/libpurple/protocols/hangouts/hangouts.h b/libpurple/protocols/hangouts/hangouts.h
new file mode 100644
--- /dev/null
+++ b/libpurple/protocols/hangouts/hangouts.h
@@ -0,0 +1,52 @@
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#ifndef _HANGOUTS_H_
+#define _HANGOUTS_H_
+
+#include "protocol.h"
+
+#define HANGOUTS_TYPE_PROTOCOL (hangouts_protocol_get_type())
+#define HANGOUTS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), HANGOUTS_TYPE_PROTOCOL, HangoutsProtocol))
+#define HANGOUTS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), HANGOUTS_TYPE_PROTOCOL, HangoutsProtocolClass))
+#define HANGOUTS_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), HANGOUTS_TYPE_PROTOCOL))
+#define HANGOUTS_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), HANGOUTS_TYPE_PROTOCOL))
+#define HANGOUTS_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), HANGOUTS_TYPE_PROTOCOL, HangoutsProtocolClass))
+
+typedef struct _HangoutsProtocol HangoutsProtocol;
+typedef struct _HangoutsProtocolClass HangoutsProtocolClass;
+
+struct _HangoutsProtocol
+{
+ PurpleProtocol parent;
+};
+
+struct _HangoutsProtocolClass
+{
+ PurpleProtocolClass parent_class;
+};
+
+/**
+ * Returns the GType for the HangoutsProtocol object.
+ */
+G_MODULE_EXPORT GType hangouts_protocol_get_type(void);
+
+#endif /* _HANGOUTS_H_ */
\ No newline at end of file
More information about the Commits
mailing list