diff src/server.c @ 511:3133ab511d92

[gaim-migrate @ 521] beginnings of directim, some improvements to oscar chat stuff committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 20 Jul 2000 18:34:25 +0000
parents 6e318907bcce
children eaddaa0dbbcb
line wrap: on
line diff
--- a/src/server.c	Thu Jul 20 16:45:21 2000 +0000
+++ b/src/server.c	Thu Jul 20 18:34:25 2000 +0000
@@ -157,17 +157,28 @@
 
 void serv_send_im(char *name, char *message, int away)
 {
-	if (!USE_OSCAR) {
-		char buf[MSG_LEN - 7];
+	struct conversation *cnv = find_conversation(name);
+	if (!cnv || !cnv->is_direct) {
+		if (!USE_OSCAR) {
+			char buf[MSG_LEN - 7];
 
-	        g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
-	                   message, ((away) ? " auto" : ""));
-		sflap_send(buf, strlen(buf), TYPE_DATA);
+		        g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
+		                   message, ((away) ? " auto" : ""));
+			sflap_send(buf, strlen(buf), TYPE_DATA);
+		} else {
+			if (away)
+				aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_AWAY, message);
+			else
+				aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_ACK, message);
+		}
 	} else {
-		if (away)
-			aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_AWAY, message);
-		else
-			aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_ACK, message);
+		if (!USE_OSCAR) {
+			/* FIXME */
+		} else {
+			sprintf(debug_buff, "Sending DirectIM to %s\n", name);
+			debug_print(debug_buff);
+			aim_send_im_direct(gaim_sess, cnv->conn, message);
+		}
 	}
         if (!away)
                 serv_touch_idle();
@@ -176,20 +187,20 @@
 void serv_get_info(char *name)
 {
 	if (!USE_OSCAR) {
-        char buf[MSG_LEN];
-        g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
-        sflap_send(buf, -1, TYPE_DATA);
+        	char buf[MSG_LEN];
+	        g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
+	        sflap_send(buf, -1, TYPE_DATA);
 	} else {
-	aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_GENERALINFO);
+		aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_GENERALINFO);
 	}
 }
 
 void serv_get_away_msg(char *name)
 {
 	if (!USE_OSCAR) {
-	/* HAHA! TOC doesn't have this yet */
+		/* HAHA! TOC doesn't have this yet */
 	} else {
-	aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_AWAYMESSAGE);
+		aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_AWAYMESSAGE);
 	}
 }
 
@@ -1090,3 +1101,22 @@
 			cookie, uid);
 	sflap_send(buf, strlen(buf), TYPE_DATA);
 }
+
+void serv_do_imimage(GtkWidget *w, char *name) {
+	if (!USE_OSCAR) {
+	} else {
+		oscar_do_directim(name);
+	}
+}
+
+void serv_got_imimage(char *name, char *cookie, char *ip, struct aim_conn_t *conn)
+{
+	if (!USE_OSCAR) {
+		/* FIXME */
+	} else {
+		struct conversation *cnv = find_conversation(name);
+		if (!cnv) cnv = new_conversation(name);
+		cnv->is_direct = 1;
+		cnv->conn = conn;
+	}
+}