changeset 9359:43741d8f76f7

[gaim-migrate @ 10167] More patches from Stu on patch 975859 -- this one adds back lost commands committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Wed, 23 Jun 2004 16:58:22 +0000
parents 5a9155e564d6
children d77537e8bfe5
files src/protocols/silc/Makefile.mingw src/protocols/silc/chat.c src/protocols/silc/ops.c src/protocols/silc/silc.c
diffstat 4 files changed, 285 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/protocols/silc/Makefile.mingw	Wed Jun 23 16:58:22 2004 +0000
@@ -0,0 +1,149 @@
+#
+# Makefile.mingw
+#
+# Description: Makefile for win32 (mingw) version of libsilcgaim
+#
+
+#
+# PATHS
+#
+
+INCLUDE_DIR :=		.
+GTK_TOP :=		../../../../win32-dev/gtk_2_0
+GAIM_TOP :=		../../..
+SILC_ROOT :=		.
+GAIM_INSTALL_DIR :=	$(GAIM_TOP)/win32-install-dir
+SILC_TOP :=		../../../../win32-dev/silc-toolkit
+
+##
+## VARIABLE DEFINITIONS
+##
+
+TARGET = libsilcgaim
+
+NEEDED_DLLS =	$(SILC_TOP)/lib/silc.dll \
+				$(SILC_TOP)/lib/silcclient.dll
+
+# Compiler Options
+
+CFLAGS =
+
+DEFINES =
+
+# Static or Plugin... 
+ifeq ($(TYPE),STATIC)
+  DEFINES += -DSTATIC
+  DLL_INSTALL_DIR =	$(GAIM_INSTALL_DIR)
+else
+ifeq ($(TYPE),PLUGIN)
+  DLL_INSTALL_DIR =	$(GAIM_INSTALL_DIR)/plugins
+endif
+endif
+
+
+##
+## INCLUDE  MAKEFILES
+##
+
+include $(GAIM_TOP)/src/win32/global.mak
+
+##
+## INCLUDE PATHS
+##
+
+INCLUDE_PATHS +=	-I$(SILC_ROOT) \
+			-I$(GTK_TOP)/include \
+			-I$(GTK_TOP)/include/gtk-2.0 \
+			-I$(GTK_TOP)/include/glib-2.0 \
+			-I$(GTK_TOP)/include/pango-1.0 \
+			-I$(GTK_TOP)/include/atk-1.0 \
+			-I$(GTK_TOP)/lib/glib-2.0/include \
+			-I$(GTK_TOP)/lib/gtk-2.0/include \
+			-I$(GAIM_TOP)/src \
+			-I$(GAIM_TOP)/src/win32 \
+			-I$(GAIM_TOP) \
+			-I$(SILC_TOP)/include
+
+
+LIB_PATHS =	-L$(GTK_TOP)/lib \
+			-L$(GAIM_TOP)/src \
+			-L$(SILC_TOP)/lib
+
+
+##
+##  SOURCES, OBJECTS
+##
+
+C_SRC =		silc.c \
+			buddy.c \
+			chat.c \
+			ft.c \
+			ops.c \
+			pk.c \
+			util.c
+
+
+OBJECTS = $(C_SRC:%.c=%.o)
+
+
+##
+## LIBRARIES
+##
+
+LIBS =		-lgtk-win32-2.0 \
+			-lglib-2.0 \
+			-lgdk-win32-2.0 \
+			-lgmodule-2.0 \
+			-lgobject-2.0 \
+			-lws2_32 \
+			-lintl \
+			-lgaim \
+			-lsilc \
+			-lsilcclient \
+			-lwsock32
+
+
+##
+## RULES
+##
+
+# How to make a C file
+
+%.o: %.c
+	$(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@ -c $<
+
+##
+## TARGET DEFINITIONS
+##
+
+.PHONY: all clean
+
+all: $(TARGET).dll
+
+install:
+	cp $(SILC_ROOT)/$(TARGET).dll $(DLL_INSTALL_DIR)
+	cp $(NEEDED_DLLS) $(GAIM_INSTALL_DIR)
+
+
+##
+## BUILD Dependencies
+##
+
+$(GAIM_TOP)/src/gaim.lib:
+	$(MAKE) -C $(GAIM_TOP)/src -f Makefile.mingw gaim.lib
+
+##
+## BUILD DLL
+##
+
+$(TARGET).dll: $(OBJECTS) $(GAIM_TOP)/src/gaim.lib
+	$(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).lib -o $(TARGET).dll
+
+##
+## CLEAN RULES
+##
+
+clean:
+	rm -rf *.o
+	rm -rf $(TARGET).dll
+	rm -rf $(TARGET).lib
--- a/src/protocols/silc/chat.c	Wed Jun 23 15:12:02 2004 +0000
+++ b/src/protocols/silc/chat.c	Wed Jun 23 16:58:22 2004 +0000
@@ -1217,6 +1217,7 @@
 	SilcUInt32 flags;
 	int ret;
 	const char *msg2;
+	char *tmp;
 	gboolean found = FALSE;
 	gboolean sign = gaim_prefs_get_bool("/plugins/prpl/silc/sign_chat");
 
@@ -1282,9 +1283,12 @@
 	ret = silc_client_send_channel_message(client, conn, channel, key,
 					       flags, (unsigned char *)msg2,
 					       strlen(msg2), TRUE);
-	if (ret)
-		serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, msg,
+	if (ret) {
+		tmp = gaim_escape_html(msg);
+		serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, tmp,
 				 time(NULL));
+		g_free(tmp);
+	}
 
 	return ret;
 }
--- a/src/protocols/silc/ops.c	Wed Jun 23 15:12:02 2004 +0000
+++ b/src/protocols/silc/ops.c	Wed Jun 23 16:58:22 2004 +0000
@@ -51,7 +51,7 @@
 	GaimConnection *gc = client->application;
 	SilcGaim sg = gc->proto_data;
 	GaimConversation *convo = NULL;
-	char *msg;
+	char *msg, *tmp;
 
 	if (!message)
 		return;
@@ -90,11 +90,13 @@
 		if (!msg)
 			return;
 
+		tmp = gaim_escape_html(msg);
 		/* Send to Gaim */
 		serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)),
 				 sender->nickname ?
 				 sender->nickname : "<unknown>", 0,
-				 msg, time(NULL));
+				 tmp, time(NULL));
+		g_free(tmp);
 		g_free(msg);
 		return;
 	}
@@ -114,12 +116,15 @@
 		return;
 	}
 
-	if (flags & SILC_MESSAGE_FLAG_UTF8)
+	if (flags & SILC_MESSAGE_FLAG_UTF8) {
+		tmp = gaim_escape_html((const char *)message);
 		/* Send to Gaim */
 		serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)),
 				 sender->nickname ?
 				 sender->nickname : "<unknown>", 0,
-				 (const char *)message, time(NULL));
+				 tmp, time(NULL));
+		g_free(tmp);
+	}
 }
 
 
@@ -138,7 +143,7 @@
 	GaimConnection *gc = client->application;
 	SilcGaim sg = gc->proto_data;
 	GaimConversation *convo = NULL;
-	char *msg;
+	char *msg, *tmp;
 
 	if (!message)
 		return;
@@ -162,11 +167,13 @@
 		if (!msg)
 			return;
 
+		tmp = gaim_escape_html(msg);
 		/* Send to Gaim */
 		serv_got_im(gc, sender->nickname ?
 			    sender->nickname : "<unknown>",
-			    msg, 0, time(NULL));
+			    tmp, 0, time(NULL));
 		g_free(msg);
+		g_free(tmp);
 		return;
 	}
 
@@ -185,11 +192,14 @@
 		return;
 	}
 
-	if (flags & SILC_MESSAGE_FLAG_UTF8)
+	if (flags & SILC_MESSAGE_FLAG_UTF8) {
+		tmp = gaim_escape_html((const char *)message);
 		/* Send to Gaim */
 		serv_got_im(gc, sender->nickname ?
 			    sender->nickname : "<unknown>",
-			    (const char *)message, 0, time(NULL));
+			    tmp, 0, time(NULL));
+		g_free(tmp);
+	}
 }
 
 
--- a/src/protocols/silc/silc.c	Wed Jun 23 15:12:02 2004 +0000
+++ b/src/protocols/silc/silc.c	Wed Jun 23 16:58:22 2004 +0000
@@ -883,7 +883,7 @@
 	} else if (strlen(msg) > 1 && msg[0] == '/') {
 		if (!silc_client_command_call(client, conn, msg + 1))
 			gaim_notify_error(gc, ("Call Command"), _("Cannot call command"),
-							  _("Unknown command"));
+					_("Unknown command"));
 		return 0;
 	}
 
@@ -1030,23 +1030,6 @@
 	return GAIM_CMD_RET_OK;
 }
 
-static GaimCmdRet silcgaim_cmd_chat_invite(GaimConversation *conv,
-		const char *cmd, char **args, char **error)
-{
-	int id;
-	GaimConnection *gc;
-
-	id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv));
-	gc = gaim_conversation_get_gc(conv);
-
-	if (gc == NULL)
-		return GAIM_CMD_RET_FAILED;
-
-	silcgaim_chat_invite(gc, id, NULL, args[0]);
-
-	return GAIM_CMD_RET_OK;
-}
-
 static GaimCmdRet silcgaim_cmd_msg(GaimConversation *conv,
 		const char *cmd, char **args, char **error)
 {
@@ -1177,6 +1160,50 @@
 	return GAIM_CMD_RET_OK;
 }
 
+static GaimCmdRet silcgaim_cmd_quit(GaimConversation *conv,
+		const char *cmd, char **args, char **error)
+{
+	GaimConnection *gc;
+	SilcGaim sg;
+
+	gc = gaim_conversation_get_gc(conv);
+
+	if (gc == NULL)
+		return GAIM_CMD_RET_FAILED;
+
+	sg = gc->proto_data;
+
+	if (sg == NULL)
+		return GAIM_CMD_RET_FAILED;
+
+	silc_client_command_call(sg->client, sg->conn, NULL,
+				 "QUIT", (args && args[0]) ? args[0] : "Download Gaim: " GAIM_WEBSITE, NULL);
+
+	return GAIM_CMD_RET_OK;
+}
+
+static GaimCmdRet silcgaim_cmd_call(GaimConversation *conv,
+		const char *cmd, char **args, char **error)
+{
+	GaimConnection *gc;
+	SilcGaim sg;
+
+	gc = gaim_conversation_get_gc(conv);
+
+	if (gc == NULL)
+		return GAIM_CMD_RET_FAILED;
+
+	sg = gc->proto_data;
+
+	if (sg == NULL)
+		return GAIM_CMD_RET_FAILED;
+
+	if (!silc_client_command_call(sg->client, sg->conn, args[0]))
+		return GAIM_CMD_RET_FAILED;
+
+	return GAIM_CMD_RET_OK;
+}
+
 
 /************************** Plugin Initialization ****************************/
 
@@ -1208,10 +1235,6 @@
 			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
 			"prpl-silc",
 			silcgaim_cmd_whois, _("whois &lt;nick&gt;:  View nick's information"));
-	gaim_cmd_register("invite", "w", GAIM_CMD_P_PRPL,
-			GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
-			"prpl-silc", silcgaim_cmd_chat_invite,
-			_("invite &lt;nick&gt;:  Invite nick to join this channel"));
 	gaim_cmd_register("msg", "ws", GAIM_CMD_P_PRPL,
 			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
 			"prpl-silc", silcgaim_cmd_msg,
@@ -1228,10 +1251,77 @@
 			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
 			"prpl-silc", silcgaim_cmd_detach,
 			_("detach:  Detach this session"));
+	gaim_cmd_register("quit", "s", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
+			GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_quit,
+			"");
+	gaim_cmd_register("call", "s", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
+			"prpl-silc", silcgaim_cmd_call,
+			"");
+	/* These below just get passed through for the silc client library to deal with */
+	gaim_cmd_register("kill", "ws", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
+			GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("nick", "w", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
+			"prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("cmode", "wws", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
+			GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("cumode", "wws", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
+			GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic,
+			"");
 	gaim_cmd_register("umode", "w", GAIM_CMD_P_PRPL,
 			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
 			"prpl-silc", silcgaim_cmd_generic,
 			_("umode &lt;usermodes&gt;:  Set your user options"));
+	gaim_cmd_register("oper", "s", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
+			"prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("invite", "ws", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
+			GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("kick", "wws", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
+			GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("info", "ww", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
+			GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("ban", "ww", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
+			GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("ping", "", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
+			"prpl-silc", silcgaim_cmd_generic,
+			"");
+#if 0 /* Gaim doesn't handle the reply for these yet */
+	gaim_cmd_register("stats", "", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
+			"prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("whowas", "ww", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY |
+			GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("users", "s", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
+			"prpl-silc", silcgaim_cmd_generic,
+			"");
+	gaim_cmd_register("getkey", "w", GAIM_CMD_P_PRPL,
+			GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,
+			"prpl-silc", silcgaim_cmd_generic,
+			"");
+#endif
 }
 
 static GaimPluginPrefFrame *