changeset 9988:d770673338f4

[gaim-migrate @ 10901] (15:20:15) grim elite: ok.. i just got to make a big #if 0 because the custom away messages aren't setup yet :/ (15:30:01) grim elite: ok i've got it compiling.. couple of warnings yet.. (15:34:24) grim elite: www.reaperworld.com/code/gaim/gaim-2.0.0cvs-oscar_compiles.diff Mark should look this over, but it seems fairly straight forward committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 08 Sep 2004 19:36:04 +0000
parents 5eedb0a9093d
children e4d971338093
files src/account.c src/protocols/oscar/oscar.c
diffstat 2 files changed, 32 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Wed Sep 08 14:30:13 2004 +0000
+++ b/src/account.c	Wed Sep 08 19:36:04 2004 +0000
@@ -794,6 +794,16 @@
 	return ((p && p->info->name) ? _(p->info->name) : _("Unknown"));
 }
 
+const char *
+gaim_account_get_protocol_name(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, NULL);
+
+	GaimPlugin *p = gaim_find_prpl(gaim_account_get_protocol_id(account));
+
+	return ((p && p->info->name) ? _(p->info->name) : _("Unknown"));
+}
+
 GaimConnection *
 gaim_account_get_connection(const GaimAccount *account)
 {
--- a/src/protocols/oscar/oscar.c	Wed Sep 08 14:30:13 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Sep 08 19:36:04 2004 +0000
@@ -46,6 +46,7 @@
 #include "aim.h"
 #include "md5.h"
 
+#define OSCAR_STATUS_ID_AVAILABLE	"available"
 #define OSCAR_STATUS_ID_INVISIBLE	"invisible"
 #define OSCAR_STATUS_ID_OFFLINE		"offline"
 #define OSCAR_STATUS_ID_ONLINE		"online"
@@ -5529,13 +5530,18 @@
 	return;
 }
 
-static void oscar_set_status_aim(GaimConnection *gc, OscarData *od, const char *state, const char *text)
+static void oscar_set_status_aim(GaimAccount *account, GaimStatus *status)
 {
+	OscarData *od;
 	int charset = 0;
 	gchar *text_html = NULL;
+	const gchar *state;
 	char *msg = NULL;
 	gsize msglen = 0;
 
+	od = (OscarData *)account->gc->proto_data;
+	state = gaim_status_get_name(status);
+
 	if (!strcmp(state, _("Visible"))) {
 		aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL);
 		return;
@@ -5554,18 +5560,14 @@
 	aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL);
 
 	if (od->rights.maxawaymsglen == 0)
-		gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."),
+		gaim_notify_warning(account->gc, NULL, _("Unable to set AIM away message."),
 							_("You have probably requested to set your "
 							  "away message before the login procedure "
 							  "completed.  You remain in a \"present\" "
 							  "state; try setting it again when you are "
 							  "fully connected."));
 
-	if (gc->away) {
-		g_free(gc->away);
-		gc->away = NULL;
-	}
-
+#if 0 /* this needs to be fixed when we have the custom away messages setup below */
 	if (!text) {
 		aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0);
 		return;
@@ -5605,17 +5607,15 @@
 	}
 	
 	g_free(text_html);
+#endif
 
 	return;
 }
 
-static void oscar_set_status_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message)
+static void oscar_set_status_icq(GaimAccount *account, GaimStatus *status)
 {
-	GaimAccount *account = gaim_connection_get_account(gc);
-	if (gc->away) {
-		g_free(gc->away);
-		gc->away = NULL;
-	}
+	OscarData *od = (OscarData *)account->gc->proto_data;
+	const gchar *state = gaim_status_get_name(status);
 
 	if (strcmp(state, _("Invisible")))
 		account->perm_deny = 4;
@@ -5628,42 +5628,37 @@
 		aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL);
 	else if (!strcmp(state, _("Away"))) {
 		aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY);
-		gc->away = g_strdup("");
 	} else if (!strcmp(state, _("Do Not Disturb"))) {
 		aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY);
-		gc->away = g_strdup("");
 	} else if (!strcmp(state, _("Not Available"))) {
 		aim_setextstatus(od->sess, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
-		gc->away = g_strdup("");
 	} else if (!strcmp(state, _("Occupied"))) {
 		aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY);
-		gc->away = g_strdup("");
 	} else if (!strcmp(state, _("Free For Chat"))) {
 		aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT);
-		gc->away = g_strdup("");
 	} else if (!strcmp(state, _("Invisible"))) {
 		aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE);
-		gc->away = g_strdup("");
+#if 0 /* XXX fix me!! */
 	} else if (!strcmp(state, GAIM_AWAY_CUSTOM)) {
 	 	if (message) {
 			aim_setextstatus(od->sess, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
-			gc->away = g_strdup("");
 		} else {
 			aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL);
 		}
+#endif
 	}
 
 	return;
 }
 
-static void oscar_set_status(GaimConnection *gc, const char *state, const char *message)
+static void oscar_set_status(GaimAccount *account, GaimStatus *status)
 {
-	OscarData *od = (OscarData *)gc->proto_data;
+	OscarData *od = (OscarData *)account->gc->proto_data;
 
 	if (od->icq)
-		oscar_set_status_icq(gc, od, state, message);
+		oscar_set_status_icq(account, status);
 	else
-		oscar_set_status_aim(gc, od, state, message);
+		oscar_set_status_aim(account, status);
 
 	return;
 }
@@ -5893,6 +5888,7 @@
 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
 	GaimConnection *gc = sess->aux_data;
 	GaimAccount *account = gaim_connection_get_account(gc);
+	GaimStatus *status;
 	OscarData *od = (OscarData *)gc->proto_data;
 	GaimGroup *g;
 	GaimBuddy *b;
@@ -6083,7 +6079,8 @@
 								   "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny);
 						account->perm_deny = permdeny;
 						if (od->icq && account->perm_deny == 0x03) {
-							serv_set_status(gc, "Invisible", "");
+							gaim_presence_switch_status(account->presence,
+														OSCAR_STATUS_ID_INVISIBLE);	
 						}
 					}
 				}