--- a/avatar.c Sat May 07 14:50:13 2011 +0300
+++ b/avatar.c Wed Jun 29 19:13:39 2011 +0300
@@ -43,6 +43,7 @@
#include <mcabber/settings.h>
#include <mcabber/modules.h>
#include <mcabber/xmpp_helper.h>
+#include <mcabber/api.h>
#include <mcabber/pep.h>
@@ -59,9 +60,9 @@
"Provides command /avatar" )
static const gchar *deps[] = { "pep", NULL };
-static module_info_t info_avatar_experimental = {
- .branch = "experimental",
- .api = 28,
+static module_info_t info_avatar_dev = {
+ .branch = "dev",
+ .api = 20,
.version = PROJECT_VERSION,
.description = DESCRIPTION,
.requires = deps,
@@ -70,15 +71,15 @@
.next = NULL,
};
-static module_info_t info_avatar_dev = {
- .branch = "dev",
- .api = 13,
+module_info_t info_avatar_0_10_1 = {
+ .branch = "0.10.1",
+ .api = 1,
.version = PROJECT_VERSION,
.description = DESCRIPTION,
.requires = deps,
.init = avatar_init,
.uninit = avatar_uninit,
- .next = &info_avatar_experimental,
+ .next = &info_avatar_dev,
};
module_info_t info_avatar = {
@@ -89,7 +90,7 @@
.requires = deps,
.init = avatar_init,
.uninit = avatar_uninit,
- .next = &info_avatar_dev,
+ .next = &info_avatar_0_10_1,
};
// globals
@@ -98,12 +99,10 @@
#define NS_AVATAR_METADATA ( "urn:xmpp:avatar:metadata" )
#define NS_AVATAR_METADATA_NOTIFY ( "urn:xmpp:avatar:metadata+notify" )
-#ifdef HAVE_CMD_ID
+#ifdef MCABBER_API_HAVE_CMD_ID
static gpointer avatar_cmid = NULL;
-#ifdef HAVE_CMD_SAFE
static gboolean avatar_set_safe = FALSE;
#endif
-#endif
static guint avatar_hid_connect = 0;
static guint avatar_hid_disconnect = 0;
@@ -362,6 +361,10 @@
finalcharw = rescharw;
finalh = rescharh * aappch;
finalw = rescharw * aappcw;
+#if 0
+ // I do not know, why I added this here, and it needs more digging
+ // to know, if this is supposed to be used somewhere, so, for now
+ // let it be this way
int finalh_rp;
int finalw_rp;
if (aapixelaspect > 1) {
@@ -371,6 +374,7 @@
finalh_rp = (float) finalh / aapixelaspect;
finalw_rp = finalw;
}
+#endif
finalratioh = (float) originh / finalh;
finalratiow = (float) originw / finalw;
@@ -912,7 +916,7 @@
lm_message_node_set_attribute (node, "xmlns", NS_AVATAR_METADATA);
if (len) {
- gchar *bytes = g_strdup_printf ("%d", len);
+ gchar *bytes = g_strdup_printf ("%u", (guint) len);
node = lm_message_node_add_child (node, "info", NULL);
lm_message_node_set_attributes (node, "bytes", bytes, "id", id, "type", "image/png", NULL);
@@ -1172,14 +1176,12 @@
pep_register_xmlns_handler (NS_AVATAR_METADATA, avatar_handler, NULL, NULL);
avatar_metadata_reply_handler = lm_message_handler_new (avatar_publish_metadata_reply_handler, NULL, NULL);
-#ifndef HAVE_CMD_ID
+#ifndef MCABBER_API_HAVE_CMD_ID
cmd_add ("avatar", "", COMPL_FILENAME, 0, do_avatar, NULL);
#else
avatar_cmid = cmd_add ("avatar", "", COMPL_FILENAME, 0, do_avatar, NULL);
-#ifdef HAVE_CMD_SAFE
avatar_set_safe = cmd_set_safe ("avatar", TRUE);
#endif
-#endif
avatar_hid_connect = hk_add_handler (avatar_hch, HOOK_POST_CONNECT, G_PRIORITY_DEFAULT, NULL);
avatar_hid_disconnect = hk_add_handler (avatar_hdh, HOOK_PRE_DISCONNECT, G_PRIORITY_DEFAULT, NULL);
@@ -1196,16 +1198,14 @@
hk_del_handler (HOOK_POST_CONNECT, avatar_hid_connect);
hk_del_handler (HOOK_PRE_DISCONNECT, avatar_hid_disconnect);
-#ifndef HAVE_CMD_ID
+#ifndef MCABBER_API_HAVE_CMD_ID
cmd_del ("avatar");
#else
if (avatar_cmid)
cmd_del (avatar_cmid);
-#ifdef HAVE_CMD_SAFE
if (avatar_set_safe)
cmd_set_safe ("avatar", FALSE);
#endif
-#endif
pep_unregister_xmlns_handler (NS_AVATAR_METADATA);