Split apart demo's PurpleProtocolClient implementation

Sat, 12 Mar 2022 23:00:44 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Sat, 12 Mar 2022 23:00:44 -0600
changeset 41285
cc3c735c14f4
parent 41284
7b29786ffdc7
child 41286
a0f2d660128d

Split apart demo's PurpleProtocolClient implementation

libpurple/protocols/demo/meson.build file | annotate | diff | comparison | revisions
libpurple/protocols/demo/purpledemoprotocol.c file | annotate | diff | comparison | revisions
libpurple/protocols/demo/purpledemoprotocolclient.c file | annotate | diff | comparison | revisions
libpurple/protocols/demo/purpledemoprotocolclient.h file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/demo/meson.build	Sat Mar 12 23:00:44 2022 -0600
+++ b/libpurple/protocols/demo/meson.build	Sat Mar 12 23:00:44 2022 -0600
@@ -5,6 +5,8 @@
 	'purpledemoplugin.h',
 	'purpledemoprotocol.c',
 	'purpledemoprotocol.h',
+	'purpledemoprotocolclient.c',
+	'purpledemoprotocolclient.h',
 	'purpledemoprotocolim.c',
 	'purpledemoprotocolim.h',
 ]
--- a/libpurple/protocols/demo/purpledemoprotocol.c	Sat Mar 12 23:00:44 2022 -0600
+++ b/libpurple/protocols/demo/purpledemoprotocol.c	Sat Mar 12 23:00:44 2022 -0600
@@ -21,6 +21,7 @@
 #include <glib/gi18n-lib.h>
 
 #include "purpledemoprotocol.h"
+#include "purpledemoprotocolclient.h"
 #include "purpledemoprotocolim.h"
 
 #include "purpledemocontacts.h"
@@ -30,35 +31,6 @@
 };
 
 /******************************************************************************
- * PurpleProtocolClient Implementation
- *****************************************************************************/
-static gchar *
-purple_demo_protocol_status_text(PurpleProtocolClient *client,
-                                 PurpleBuddy *buddy)
-{
-	PurplePresence *presence = NULL;
-	PurpleStatus *status = NULL;
-	const gchar *message = NULL;
-	gchar *ret = NULL;
-
-	presence = purple_buddy_get_presence(buddy);
-	status = purple_presence_get_active_status(presence);
-
-	message = purple_status_get_attr_string(status, "message");
-	if(message != NULL) {
-		ret = g_markup_escape_text(message, -1);
-		purple_util_chrreplace(ret, '\n', ' ');
-	}
-
-	return ret;
-}
-
-static void
-purple_demo_protocol_client_init(PurpleProtocolClientInterface *iface) {
-	iface->status_text = purple_demo_protocol_status_text;
-}
-
-/******************************************************************************
  * PurpleProtocol Implementation
  *****************************************************************************/
 static void
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/demo/purpledemoprotocolclient.c	Sat Mar 12 23:00:44 2022 -0600
@@ -0,0 +1,51 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <glib/gi18n-lib.h>
+
+#include "purpledemoprotocol.h"
+#include "purpledemoprotocolclient.h"
+
+/******************************************************************************
+ * PurpleProtocolClient Implementation
+ *****************************************************************************/
+static gchar *
+purple_demo_protocol_status_text(PurpleProtocolClient *client,
+                                 PurpleBuddy *buddy)
+{
+	PurplePresence *presence = NULL;
+	PurpleStatus *status = NULL;
+	const gchar *message = NULL;
+	gchar *ret = NULL;
+
+	presence = purple_buddy_get_presence(buddy);
+	status = purple_presence_get_active_status(presence);
+
+	message = purple_status_get_attr_string(status, "message");
+	if(message != NULL) {
+		ret = g_markup_escape_text(message, -1);
+		purple_util_chrreplace(ret, '\n', ' ');
+	}
+
+	return ret;
+}
+
+void
+purple_demo_protocol_client_init(PurpleProtocolClientInterface *iface) {
+	iface->status_text = purple_demo_protocol_status_text;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/demo/purpledemoprotocolclient.h	Sat Mar 12 23:00:44 2022 -0600
@@ -0,0 +1,28 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef PURPLE_DEMO_PROTOCOL_CLIENT_H
+#define PURPLE_DEMO_PROTOCOL_CLIENT_H
+
+#include <glib.h>
+
+#include <purple.h>
+
+G_GNUC_INTERNAL void purple_demo_protocol_client_init(PurpleProtocolClientInterface *iface);
+
+#endif /* PURPLE_DEMO_PROTOCOL_CLIENT_H */

mercurial