changeset 1768:9aae465eeb6e

[gaim-migrate @ 1778] Start of the queueing stuff committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Sat, 28 Apr 2001 02:01:28 +0000
parents 5461acb8940a
children 68eddf56f419
files src/aim.c src/away.c src/gaim.h src/server.c
diffstat 4 files changed, 59 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/aim.c	Fri Apr 27 23:53:19 2001 +0000
+++ b/src/aim.c	Sat Apr 28 02:01:28 2001 +0000
@@ -68,6 +68,7 @@
 GSList *away_messages = NULL;
 GList *conversations = NULL;
 GList *chat_rooms = NULL;
+GSList *message_queue = NULL;
 
 GtkWidget *mainwindow = NULL;
 
--- a/src/away.c	Fri Apr 27 23:53:19 2001 +0000
+++ b/src/away.c	Sat Apr 28 02:01:28 2001 +0000
@@ -55,6 +55,20 @@
 {
 	if (imaway) {
 		GtkWidget *tmp = imaway;
+		/*GSList *templist = message_queue;
+
+		while (templist)
+		{
+			struct queued_message *qm = (struct queued_message *)templist->data;
+
+			free(qm->message);
+
+			message_queue = g_slist_remove(message_queue, qm);
+
+			free(qm);
+		}
+		*/
+		
 		imaway = NULL;
 		gtk_widget_destroy(tmp);
 		if (w != tmp)
--- a/src/gaim.h	Fri Apr 27 23:53:19 2001 +0000
+++ b/src/gaim.h	Sat Apr 28 02:01:28 2001 +0000
@@ -268,6 +268,13 @@
 	int options;
 };
 
+struct queued_message {
+	char name[80];
+	char *message;
+	time_t tm;
+	struct gaim_connection *gc;
+};
+
 struct away_message {
 	char name[80];
 	char message[2048];
@@ -528,11 +535,12 @@
 #define OPT_USR_KEEPALV		0x00000002
 #define OPT_USR_REM_PASS	0x00000004
 
-#define DEFAULT_INFO "Visit the GAIM website at <A HREF=\"http://www.marko.net/gaim\">http://www.marko.net/gaim</A>."
+#define DEFAULT_INFO "Visit the GAIM website at <A HREF=\"http://gaim.sourceforge.net/\">http://gaim.sourceforge.net/</A>."
 
 extern int report_idle;
 extern int web_browser;
 extern GList *aim_users;
+extern GSList *message_queue;
 extern char sound_cmd[2048];
 extern char web_command[2048];
 extern struct save_pos blist_pos;
--- a/src/server.c	Fri Apr 27 23:53:19 2001 +0000
+++ b/src/server.c	Sat Apr 28 02:01:28 2001 +0000
@@ -309,12 +309,11 @@
 	serv_touch_idle(g);
 }
 
-
-
 void serv_got_im(struct gaim_connection *gc, char *name, char *message, int away, time_t mtime)
 {
 	struct conversation *cnv;
 	int new_conv = 0;
+	int hehe = away;
 
 	char *buffy = g_strdup(message);
 	char *angel = g_strdup(name);
@@ -368,9 +367,27 @@
 			return;
 		}
 		if (cnv != NULL) {
+
 			if (cnv->makesound && (sound_options & OPT_SOUND_RECV))
 				play_sound(RECEIVE);
+
+			if (gc->away)
+			{
+				struct queued_message *qm;
+
+				qm = (struct queued_message *)g_new0(struct queued_message, 1);
+				snprintf(qm->name, sizeof(qm->name), "%s", name);
+				qm->message = strdup(message);
+				qm->gc = gc;
+				qm->tm = mtime;
+
+				message_queue = g_slist_append(message_queue, qm);
+
+				printf("A message has been queued.\n");
+			}
+
 			write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime);
+			
 		}
 
 	} else {
@@ -388,6 +405,22 @@
 			if (cnv->makesound && (sound_options & OPT_SOUND_RECV))
 				play_sound(RECEIVE);
 		}
+		
+		if (gc->away)
+		{
+			struct queued_message *qm;
+
+			qm = (struct queued_message *)g_new0(struct queued_message, 1);
+			snprintf(qm->name, sizeof(qm->name), "%s", name);
+			qm->message = strdup(message);
+			qm->gc = gc;
+			qm->tm = mtime;
+
+			message_queue = g_slist_append(message_queue, qm);
+
+			printf("A message has been queued.\n");
+		}
+
 		write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime);
 	}