[killpresence] Cosmetical change
authorMikael Berthe <mikael@lilotux.net>
Sat, 13 Oct 2012 17:28:47 +0200
changeset 46 3bb3be085858
parent 45 8e4d38e667ef
child 47 dcef1b8f2e05
[killpresence] Cosmetical change Move up do_probe() before do_killpresence() in order to avoid adding a function prototype.
killpresence/killpresence.c
--- a/killpresence/killpresence.c	Sat Oct 13 17:26:43 2012 +0200
+++ b/killpresence/killpresence.c	Sat Oct 13 17:28:47 2012 +0200
@@ -46,8 +46,6 @@
 static void killpresence_init(void);
 static void killpresence_uninit(void);
 
-static void do_probe(char *);
-
 /* Module description */
 module_info_t info_killpresence = {
         .branch         = MCABBER_BRANCH,
@@ -68,6 +66,45 @@
 static gpointer killpresence_cmdid, killchatstates_cmdid, probe_cmdid;
 #endif
 
+static void do_probe(char *args)
+{
+  char *jid_utf8;
+  LmMessage *m;
+  const char *targetjid = NULL;
+
+  if (!args || !*args) {
+    scr_log_print(LPRINT_NORMAL, "I need a JID.");
+    return;
+  }
+  if (strchr(args, JID_RESOURCE_SEPARATOR)) {
+    scr_log_print(LPRINT_NORMAL, "I need a *bare* JID.");
+    // XXX We could just drop the resource...
+    return;
+  }
+
+  if (!xmpp_is_online())
+    return;
+
+  jid_utf8 = to_utf8(args);
+  if (!jid_utf8)
+    return;
+
+  if (!strcmp(jid_utf8, ".")) {
+    if (current_buddy)
+      targetjid = CURRENT_JID;
+  } else {
+    targetjid = jid_utf8;
+  }
+
+  // Create presence message with type "probe"
+  m = lm_message_new(targetjid, LM_MESSAGE_TYPE_PRESENCE);
+  lm_message_node_set_attribute(m->node, "type", "probe");
+  lm_connection_send(lconnection, m, NULL);
+  lm_message_unref(m);
+  scr_log_print(LPRINT_LOGNORM, "Presence probe sent to <%s>.", targetjid);
+  g_free(jid_utf8);
+}
+
 static void do_killpresence(char *args)
 {
   char *jid_utf8, *res;
@@ -201,45 +238,6 @@
 #endif
 }
 
-static void do_probe(char *args)
-{
-  char *jid_utf8;
-  LmMessage *m;
-  const char *targetjid = NULL;
-
-  if (!args || !*args) {
-    scr_log_print(LPRINT_NORMAL, "I need a JID.");
-    return;
-  }
-  if (strchr(args, JID_RESOURCE_SEPARATOR)) {
-    scr_log_print(LPRINT_NORMAL, "I need a *bare* JID.");
-    // XXX We could just drop the resource...
-    return;
-  }
-
-  if (!xmpp_is_online())
-    return;
-
-  jid_utf8 = to_utf8(args);
-  if (!jid_utf8)
-    return;
-
-  if (!strcmp(jid_utf8, ".")) {
-    if (current_buddy)
-      targetjid = CURRENT_JID;
-  } else {
-    targetjid = jid_utf8;
-  }
-
-  // Create presence message with type "probe"
-  m = lm_message_new(targetjid, LM_MESSAGE_TYPE_PRESENCE);
-  lm_message_node_set_attribute(m->node, "type", "probe");
-  lm_connection_send(lconnection, m, NULL);
-  lm_message_unref(m);
-  scr_log_print(LPRINT_LOGNORM, "Presence probe sent to <%s>.", targetjid);
-  g_free(jid_utf8);
-}
-
 
 /* Initialization */
 static void killpresence_init(void)