avatar.c
changeset 24 7aa499342e2b
parent 23 2b7060ce1152
child 25 6ad07b1d4e7f
--- a/avatar.c	Thu Mar 04 19:50:02 2010 +0200
+++ b/avatar.c	Sun Mar 14 21:27:23 2010 +0200
@@ -52,12 +52,32 @@
 static void avatar_init   (void);
 static void avatar_uninit (void);
 
+#define DESCRIPTION ( \
+	"PEP avatars handling\n" \
+	"Recognizes options avatar_directory, avatar_font_height, avatar_font_width, avatar_max_height, avatar_max_width and avatar_background\n" \
+	"Provides command /avatar" )
 static const gchar *deps[] = { "pep", NULL };
+
+static module_info_t info_avatar_experimental = {
+	.branch      = "experimental",
+	.api         = 5,
+	.version     = PROJECT_VERSION,
+	.description = DESCRIPTION,
+	.requires    = deps,
+	.init        = avatar_init,
+	.uninit      = avatar_uninit,
+	.next        = NULL,
+};
+
 module_info_t info_avatar = {
-	.mcabber_version = "0.10.0",
-	.requires        = deps,
-	.init            = avatar_init,
-	.uninit          = avatar_uninit,
+	.branch      = "dev",
+	.api         = 4,
+	.version     = PROJECT_VERSION,
+	.description = DESCRIPTION,
+	.requires    = deps,
+	.init        = avatar_init,
+	.uninit      = avatar_uninit,
+	.next        = &info_avatar_experimental,
 };
 
 // globals
@@ -651,28 +671,12 @@
 		int fonth    = settings_opt_get_int ("avatar_font_height");
 		int fontw    = settings_opt_get_int ("avatar_font_width");
 
-		// if not set explicitly, try to calculate available space
-		if (!maxcharh) {
-			char *var = getenv ("LINES");
-
-			if (var)
-				maxcharh = atoi (var);
-			else
-				maxcharh = 25;
+		// if not set explicitly, calculate available space
+		if (!maxcharh)
+			maxcharh = scr_gettextheight() - 1; // -1 due to avatar header line
 
-			maxcharh -= settings_opt_get_int ("log_win_height") + 3 + 1; // +1 due to avatar header line
-		}
-
-		if (!maxcharw) {
-			char *var = getenv ("COLUMNS");
-
-			if (var)
-				maxcharw = atoi (var);
-			else
-				maxcharw = 80;
-
-			maxcharw -= settings_opt_get_int ("roster_width") + scr_getprefixwidth ();
-		}
+		if (!maxcharw)
+			maxcharw = scr_gettextwidth();
 
 		if (!fonth)
 			fonth = 16;