changeset 513:eaddaa0dbbcb

[gaim-migrate @ 523] Oscar gets capabilities. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 21 Jul 2000 01:16:55 +0000
parents 7922abb3262d
children 44123888a941
files src/buddy.c src/gaim.h src/oscar.c src/server.c src/toc.c
diffstat 5 files changed, 51 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Thu Jul 20 20:38:44 2000 +0000
+++ b/src/buddy.c	Fri Jul 21 01:16:55 2000 +0000
@@ -39,6 +39,7 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 #include "gaim.h"
+#include <aim.h>
 #include "pixmaps/admin_icon.xpm"
 #include "pixmaps/aol_icon.xpm"
 #include "pixmaps/free_icon.xpm"
@@ -1443,11 +1444,47 @@
 }
 
 
+static char *caps_string(u_short caps)
+{
+	static char buf[BUF_LEN];
+	int count = 0, i = 0;
+	u_short bit = 1;
+	while (bit <= AIM_CAPS_SENDFILE) {
+		if (bit & caps) {
+			switch (bit) {
+			case AIM_CAPS_BUDDYICON:
+				i += g_snprintf(buf + i, sizeof(buf) - i, _("%sBuddy Icon"), count ? "," : "");
+				break;
+			case AIM_CAPS_VOICE:
+				i += g_snprintf(buf + i, sizeof(buf) - i, _("%sVoice"), count ? "," : "");
+				break;
+			case AIM_CAPS_IMIMAGE:
+				i += g_snprintf(buf + i, sizeof(buf) - i, _("%sIM Image"), count ? "," : "");
+				break;
+			case AIM_CAPS_CHAT:
+				i += g_snprintf(buf + i, sizeof(buf) - i, _("%sChat"), count ? "," : "");
+				break;
+			case AIM_CAPS_GETFILE:
+				i += g_snprintf(buf + i, sizeof(buf) - i, _("%sGet File"), count ? "," : "");
+				break;
+			case AIM_CAPS_SENDFILE:
+				i += g_snprintf(buf + i, sizeof(buf) - i, _("%sSend File"), count ? "," : "");
+				break;
+			}
+			count++;
+		}
+		bit <<= 1;
+	}
+	return buf;
+}
+
+
 void set_buddy(struct buddy *b)
 {
 	char infotip[256];
         char idlet[16];
         char warn[256];
+	char caps[256];
 	char *who;
         int i;
         int ihrs, imin;
@@ -1491,8 +1528,13 @@
 		} else
 			warn[0] = '\0';
 		
-                i = g_snprintf(infotip, sizeof(infotip), _("Name: %s                \nLogged in: %s\n%s%s%s"), b->name, sotime, warn, ((b->idle) ? _("Idle: ") : ""),  itime);
+		if (b->caps) {
+			g_snprintf(caps, sizeof(caps), _("Capabilities: %s\n"), caps_string(b->caps));
+		} else
+			caps[0] = '\0';
 		
+                i = g_snprintf(infotip, sizeof(infotip), _("Name: %s                \nLogged in: %s\n%s%s%s\n%s"), b->name, sotime, warn, ((b->idle) ? _("Idle: ") : ""),  itime, caps);
+
 		gtk_tooltips_set_tip(tips, GTK_WIDGET(b->item), infotip, "");
 
                 g_free(sotime);
--- a/src/gaim.h	Thu Jul 20 20:38:44 2000 +0000
+++ b/src/gaim.h	Fri Jul 21 01:16:55 2000 +0000
@@ -195,6 +195,7 @@
 	time_t signon;
 	time_t idle;
         int uc;
+	u_short caps; /* woohoo! */
 };
 
 struct log_conversation {
@@ -379,7 +380,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 521 $"
+#define REVISION "gaim:$Revision: 523 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -581,7 +582,7 @@
 extern void serv_do_imimage(GtkWidget *, char *);
 
 /* output from serv */
-extern void serv_got_update(char *, int, int, time_t, time_t, int);
+extern void serv_got_update(char *, int, int, time_t, time_t, int, u_short);
 extern void serv_got_im(char *, char *, int);
 extern void serv_got_eviled(char *, int);
 extern void serv_got_chat_invite(char *, int, char *, char *);
--- a/src/oscar.c	Thu Jul 20 20:38:44 2000 +0000
+++ b/src/oscar.c	Fri Jul 21 01:16:55 2000 +0000
@@ -515,7 +515,7 @@
 		time_idle = 0;
 
 	serv_got_update(info->sn, 1, info->warnlevel, info->onlinesince,
-			time_idle, type);
+			time_idle, type, info->capabilities);
 
 	return 1;
 }
@@ -529,7 +529,7 @@
 	sn = va_arg(ap, char *);
 	va_end(ap);
 
-	serv_got_update(sn, 0, 0, 0, 0, 0);
+	serv_got_update(sn, 0, 0, 0, 0, 0, 0);
 
 	return 1;
 }
--- a/src/server.c	Thu Jul 20 20:38:44 2000 +0000
+++ b/src/server.c	Fri Jul 21 01:16:55 2000 +0000
@@ -744,7 +744,7 @@
 
 
 
-void serv_got_update(char *name, int loggedin, int evil, time_t signon, time_t idle, int type)
+void serv_got_update(char *name, int loggedin, int evil, time_t signon, time_t idle, int type, u_short caps)
 {
         struct buddy *b;
         char *nname;
@@ -822,6 +822,7 @@
 	}
 #endif
         b->uc = type;
+	b->caps = caps;
         
         b->signon = signon;
 
--- a/src/toc.c	Thu Jul 20 20:38:44 2000 +0000
+++ b/src/toc.c	Fri Jul 21 01:16:55 2000 +0000
@@ -442,7 +442,7 @@
                 } else
                         time_idle = 0;
 		
-                serv_got_update(c, logged, evil, signon, time_idle, type);
+                serv_got_update(c, logged, evil, signon, time_idle, type, 0);
 
 	} else if (!strcasecmp(c, "CONFIG")) {
 		/* do we want to load the buddy list again here? */