diff -Nru -x stamp-h1 -x version.h -x .deps -x POTFILES -x 'config.*' -x libtool -x autom4te.cache -x Makefile -x Makefile.in macopix-1.0.4/src/balloon.c macopix-1.0.4-sockmsg/src/balloon.c
--- macopix-1.0.4/src/balloon.c	2004-02-12 04:50:12.000000000 +0100
+++ macopix-1.0.4-sockmsg/src/balloon.c	2004-07-05 18:04:50.000000000 +0200
@@ -358,6 +358,9 @@
       strcpy(w_tmp,_("POP3 access error"));
       balseqp_biff=BALLOON_EXPIRE;
       break;
+    case BALLOON_SOCKMSG:
+      strncpy(w_tmp,mascot->sockmsg,1023);
+      break;     
     default:
       strcpy(w_tmp,mascot->click_word[mascot->anime_ptn]);
     }
@@ -481,7 +484,9 @@
       i_wp++;
     }
     else{ // ¥Ð¥ë¡¼¥ó¹ßÃå¾õÂÖ
-      if((mascot->bal_mode==BALLOON_MAIL)
+      if(mascot->bal_mode==BALLOON_SOCKMSG) {
+        balseqp=-3;
+      } else if((mascot->bal_mode==BALLOON_MAIL)
 	 ||(mascot->bal_mode==BALLOON_POPERROR)){
 	balseqp=-2;
       }
@@ -508,6 +513,9 @@
       else{
 	balseqp_biff--;
       }
+    } else if(balseqp==-3){
+      gtk_widget_unmap(balloon_main);
+      flag_balloon=FALSE;
     }
   }
   old_x=mascot->x;
diff -Nru -x stamp-h1 -x version.h -x .deps -x POTFILES -x 'config.*' -x libtool -x autom4te.cache -x Makefile -x Makefile.in macopix-1.0.4/src/main.c macopix-1.0.4-sockmsg/src/main.c
--- macopix-1.0.4/src/main.c	2004-05-11 07:39:42.000000000 +0200
+++ macopix-1.0.4-sockmsg/src/main.c	2004-07-05 23:14:36.000000000 +0200
@@ -32,6 +32,8 @@
 #include <string.h>
 #include <dirent.h>
 
+#include "sockmsg.h"
+
 // *** GLOBAL ARGUMENT ***
 typMascot *Mascot;
 GtkWidget *win_main, *clock_main, *balloon_main, *conf_main, *biff_pix;
@@ -2883,6 +2885,9 @@
 #ifndef USE_GTK2
   gchar *rcfile=NULL;
 #endif
+  SockMsgInitResult sockres;
+  int i_opt = 1;
+  gchar *msg = NULL;
 
   // GetText
   setlocale (LC_ALL, "");
@@ -2892,6 +2897,33 @@
   bind_textdomain_codeset(PACKAGE, "UTF-8");
 #endif
 
+  while(i_opt < argc) {
+    if((strcmp(argv[i_opt],"--message") == 0))
+      msg = argv[i_opt + 1];
+    i_opt++;
+  }
+
+
+  sockres = sockmsg_init();
+  switch (sockres) {
+  case SOCKMSG_ERROR:
+    return -1;
+  case SOCKMSG_OPENED:
+  {
+    if (msg == NULL)
+      sockmsg_send_msg(_("Macopix already running"));
+    else
+      sockmsg_send_msg(msg);
+    return 0;
+  }
+  default:
+    if (msg != NULL){
+      g_print(_("Macopix not running\n"));
+      return -1;
+    }
+    break;
+  }
+
   RANDOMIZE();    /* Íð¿ô·Ï½é´ü²½ */
 
   Mascot=g_malloc0(sizeof(typMascot));
@@ -3075,8 +3107,12 @@
 
   SetMailChecker((gpointer)Mascot);
 
+  sockmsg_set_mascot(Mascot);
+
   gtk_main();
 
+  sockmsg_done();
+
   return 0;
 }
   
diff -Nru -x stamp-h1 -x version.h -x .deps -x POTFILES -x 'config.*' -x libtool -x autom4te.cache -x Makefile -x Makefile.in macopix-1.0.4/src/main.h macopix-1.0.4-sockmsg/src/main.h
--- macopix-1.0.4/src/main.h	2004-05-13 22:58:41.000000000 +0200
+++ macopix-1.0.4-sockmsg/src/main.h	2004-07-05 16:55:17.000000000 +0200
@@ -22,6 +22,8 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 //
 
+#ifndef MAIN_H
+#define MAIN_H 1
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
@@ -148,6 +150,7 @@
 #define BALLOON_NORMAL    0
 #define BALLOON_MAIL      1
 #define BALLOON_POPERROR  2
+#define BALLOON_SOCKMSG   3
 
 // BiffÍÑ Balloon¤Î¼«Á³¾ÃÌÇ¥³¥Þ¿ô
 #define BALLOON_EXPIRE    150
@@ -498,6 +501,8 @@
   gint cons_check_mode;
   gchar *sjis_filter;
   gchar *euc_filter;
+  gchar *sockmsg;
   typCursor cursor;
 }typMascot;
 
+#endif
diff -Nru -x stamp-h1 -x version.h -x .deps -x POTFILES -x 'config.*' -x libtool -x autom4te.cache -x Makefile -x Makefile.in macopix-1.0.4/src/Makefile.am macopix-1.0.4-sockmsg/src/Makefile.am
--- macopix-1.0.4/src/Makefile.am	2004-02-15 09:39:58.000000000 +0100
+++ macopix-1.0.4-sockmsg/src/Makefile.am	2004-07-05 16:39:55.000000000 +0200
@@ -1,8 +1,8 @@
 bin_PROGRAMS    = macopix
 macopix_SOURCES   =\
 	 main.c callbacks.c pixmap.c gui.c balloon.c configfile.c utils.c\
-         mail.c pop.c md5c.c md5ify.c nokkari.c bmp.c bmpwrite.c\
-	 intl.h main.h configfile.h libpop.h md5.h md5global.h nokkari.h bmp.h
+         mail.c pop.c md5c.c md5ify.c nokkari.c bmp.c bmpwrite.c sockmsg.c\
+	 intl.h main.h configfile.h libpop.h md5.h md5global.h nokkari.h bmp.h sockmsg.h
 INCLUDES        = @GTK_CFLAGS@  @GDK_PIXBUF_CFLAGS@
 LDADD           = @GTK_LIBS@  @GDK_PIXBUF_LIBS@ $(PNGLIB_LIBS)
 CLEANFILES      = *~
diff -Nru -x stamp-h1 -x version.h -x .deps -x POTFILES -x 'config.*' -x libtool -x autom4te.cache -x Makefile -x Makefile.in macopix-1.0.4/src/sockmsg.c macopix-1.0.4-sockmsg/src/sockmsg.c
--- macopix-1.0.4/src/sockmsg.c	1970-01-01 01:00:00.000000000 +0100
+++ macopix-1.0.4-sockmsg/src/sockmsg.c	2004-07-06 22:25:02.000000000 +0200
@@ -0,0 +1,168 @@
+#include <glib.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netdb.h>
+
+#include "sockmsg.h"
+
+extern gboolean flag_balloon;
+
+static gchar *get_socket_name(void)
+{
+	static gchar *filename = NULL;
+
+	if (filename == NULL) {
+		filename = g_strdup_printf("%s%cmacopix-%d",
+					   g_get_tmp_dir(), G_DIR_SEPARATOR,
+					   getuid());
+	}
+
+	return filename;
+}
+
+static gint fd_open_unix(const gchar *path)
+{
+	gint sock;
+	struct sockaddr_un addr;
+
+	sock = socket(PF_UNIX, SOCK_STREAM, 0);
+
+	if (sock < 0) {
+		perror("sock_open_unix(): socket");
+		return -1;
+	}
+
+	memset(&addr, 0, sizeof(addr));
+	addr.sun_family = AF_UNIX;
+	strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
+
+	if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+		perror("bind");
+		close(sock);
+		return -1;
+	}
+
+	if (listen(sock, 1) < 0) {
+		perror("listen");
+		close(sock);
+		return -1;		
+	}
+
+	return sock;
+}
+
+static gint fd_connect_unix(const gchar *path)
+{
+	gint sock;
+	struct sockaddr_un addr;
+
+	sock = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (sock < 0) {
+		perror("sock_connect_unix(): socket");
+		return -1;
+	}
+
+	memset(&addr, 0, sizeof(addr));
+	addr.sun_family = AF_UNIX;
+	strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
+
+	if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+		close(sock);
+		return -1;
+	}
+
+	return sock;
+}
+
+static gint fd_accept(gint sock)
+{
+	struct sockaddr_in caddr;
+	gint caddr_len;
+
+	caddr_len = sizeof(caddr);
+	return accept(sock, (struct sockaddr *)&caddr, &caddr_len);
+}
+
+static gint fd_close(gint fd)
+{
+	return close(fd);
+}
+
+static gboolean io_callback(GIOChannel * source,
+		  GIOCondition condition, gpointer data)
+{
+	gchar buf[2048];
+	gint fd, readsize;
+	typMascot *mascot = data;
+
+	fd = fd_accept(g_io_channel_unix_get_fd(source));
+
+	readsize = read(fd, buf, 2047);
+	buf[readsize] = '\0';
+
+	fd_close(fd);
+
+	mascot->balseq=0;
+	mascot->bal_mode=BALLOON_SOCKMSG;
+	if (mascot->sockmsg != NULL)
+		g_free(mascot->sockmsg);
+	mascot->sockmsg = g_strdup(buf);
+	DoBalloon(mascot);
+	flag_balloon=TRUE;
+}
+
+gint sock = -1;
+gint io_watch = -1;
+
+SockMsgInitResult sockmsg_init() {
+	gchar *sockname;
+	SockMsgInitResult result;
+
+	sockname = get_socket_name();
+
+	sock = fd_connect_unix(sockname);
+	if (sock < 0) {
+		unlink(sockname);
+		sock = fd_open_unix(sockname);
+		if (sock < 0)
+			result = SOCKMSG_ERROR;
+		else
+			result = SOCKMSG_CREATED;
+	} else {
+		result = SOCKMSG_OPENED;
+	}
+
+	return result;
+}
+
+void sockmsg_set_mascot(typMascot *mascot)
+{
+	GIOChannel *io;
+
+	io = g_io_channel_unix_new(sock);
+	io_watch = g_io_add_watch(io, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_PRI, io_callback, mascot);
+	g_io_channel_unref(io);
+}
+
+void sockmsg_send_msg(gchar *msg)
+{
+#ifdef USE_GTK2
+        msg = g_locale_to_utf8(msg,-1,NULL,NULL,NULL);
+        if(!msg)
+    		_("(Invalid Character Code)");
+#endif
+
+	write(sock, msg, strlen(msg));
+}
+
+void sockmsg_done()
+{
+	gchar *sockname;
+
+	if (io_watch != -1)
+		g_source_remove(io_watch);
+        fd_close(sock);
+
+        sockname = get_socket_name();
+        unlink(sockname);
+}
diff -Nru -x stamp-h1 -x version.h -x .deps -x POTFILES -x 'config.*' -x libtool -x autom4te.cache -x Makefile -x Makefile.in macopix-1.0.4/src/sockmsg.h macopix-1.0.4-sockmsg/src/sockmsg.h
--- macopix-1.0.4/src/sockmsg.h	1970-01-01 01:00:00.000000000 +0100
+++ macopix-1.0.4-sockmsg/src/sockmsg.h	2004-07-05 16:56:43.000000000 +0200
@@ -0,0 +1,18 @@
+#ifndef SOCKMSG_H
+#define SOCKMSG_H 1
+
+typedef enum
+{
+  SOCKMSG_OPENED,
+  SOCKMSG_CREATED,
+  SOCKMSG_ERROR,
+} SockMsgInitResult;
+
+#include "main.h"
+
+SockMsgInitResult sockmsg_init(void);
+void sockmsg_send_msg(gchar *msg);
+void sockmsg_set_mascot(typMascot *mascot);
+void sockmsg_done(void);
+
+#endif
