aboutsummaryrefslogtreecommitdiffstats
path: root/facebook/facebook-util.c
diff options
context:
space:
mode:
authorjgeboski <jgeboski@gmail.com>2015-01-01 16:21:43 -0500
committerjgeboski <jgeboski@gmail.com>2015-01-03 14:40:48 -0500
commitaaf01c2b00420fd7e28b80c1a3c419f074b2b542 (patch)
treec22ccc9533d6850d8c22e4c5d3c9d52e0bda41d7 /facebook/facebook-util.c
parentc33c1ed33b5ab7eea97402a498e4c101f6d43202 (diff)
downloadbitlbee-facebook-aaf01c2b00420fd7e28b80c1a3c419f074b2b542.tar.gz
bitlbee-facebook-aaf01c2b00420fd7e28b80c1a3c419f074b2b542.tar.bz2
bitlbee-facebook-aaf01c2b00420fd7e28b80c1a3c419f074b2b542.tar.xz
Implemented user authentication
Diffstat (limited to 'facebook/facebook-util.c')
-rw-r--r--facebook/facebook-util.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/facebook/facebook-util.c b/facebook/facebook-util.c
new file mode 100644
index 0000000..84cc581
--- /dev/null
+++ b/facebook/facebook-util.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 James Geboski <jgeboski@gmail.com>
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <string.h>
+
+#include "facebook-util.h"
+
+/**
+ * Determines the debugging state of the plugin.
+ *
+ * @return TRUE if debugging is enabled, otherwise FALSE.
+ **/
+#ifdef DEBUG_FACEBOOK
+gboolean fb_util_debugging(void)
+{
+ static gboolean debug = FALSE;
+ static gboolean setup = FALSE;
+
+ if (G_UNLIKELY(!setup)) {
+ debug = g_getenv("BITLBEE_DEBUG") ||
+ g_getenv("BITLBEE_DEBUG_FACEBOOK");
+ setup = TRUE;
+ }
+
+ return debug;
+}
+#endif /* DEBUG_FACEBOOK */
+
+/**
+ * Compare two strings case insensitively. This is useful for where
+ * the return value must be a boolean, such as with a #GEqualFunc.
+ *
+ * @param s1 The first string.
+ * @param s2 The second string.
+ *
+ * @return TRUE if the strings are equal, otherwise FALSE.
+ **/
+gboolean fb_util_str_iequal(const gchar *s1, const gchar *s2)
+{
+ return g_ascii_strcasecmp(s1, s2) == 0;
+}