changeset 12013:39734dd473e0

[gaim-migrate @ 14306] sf patch #1167921, from Joao Lu??s Marques Pinto "This patch adds the command /nickserv, /chanserv, /memoserv, /operserv, it is safer than the /msg option because more modern ircds will ensure that the message is routed to a service and not to a "fake" client." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 09 Nov 2005 00:59:09 +0000
parents 16f75a4d9fec
children bdf8081b1bc1
files COPYRIGHT ChangeLog src/protocols/irc/cmds.c src/protocols/irc/irc.h src/protocols/irc/parse.c
diffstat 5 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Wed Nov 09 00:24:22 2005 +0000
+++ b/COPYRIGHT	Wed Nov 09 00:59:09 2005 +0000
@@ -173,6 +173,7 @@
 Havoc Pennington
 Ted Percival
 Eduardo Pérez
+Joao Luís Marques Pinto
 Ari Pollak
 Robey Pointer
 Nathan Poznick
--- a/ChangeLog	Wed Nov 09 00:24:22 2005 +0000
+++ b/ChangeLog	Wed Nov 09 00:59:09 2005 +0000
@@ -90,6 +90,8 @@
 	* SSL support for IRC connections (Daniel Atallah)
 	* Show an error message when temporarily unable to join an IRC
 	  channel or change your nick (Richard Laager)
+	* Added /nickserv, /memoserv, /chanserv and /operserv
+	  commands (Joao Luís Marques Pinto)
 
 	Other Protocol Changes:
 	* Jabber support for SRV lookups
--- a/src/protocols/irc/cmds.c	Wed Nov 09 00:24:22 2005 +0000
+++ b/src/protocols/irc/cmds.c	Wed Nov 09 00:59:09 2005 +0000
@@ -434,6 +434,23 @@
 	return 0;
 }
 
+int irc_cmd_service(struct irc_conn *irc, const char *cmd, const char *target, const char **args)
+{
+	char *capital_cmd, *buf;
+
+	if (!args || !args[0])
+		return 0;
+
+	/* cmd will be one of nickserv, chanserv, memoserv or operserv */
+	capital_cmd = g_ascii_strup(cmd, -1);
+	buf = irc_format(irc, "v:", capital_cmd, args[0]);
+	irc_send(irc, buf);
+	g_free(capital_cmd);
+	g_free(buf);
+
+	return 0;
+}
+
 int irc_cmd_time(struct irc_conn *irc, const char *cmd, const char *target, const char **args)
 {
 	char *buf;
--- a/src/protocols/irc/irc.h	Wed Nov 09 00:24:22 2005 +0000
+++ b/src/protocols/irc/irc.h	Wed Nov 09 00:59:09 2005 +0000
@@ -162,6 +162,7 @@
 int irc_cmd_quote(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
 int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
 int irc_cmd_remove(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
+int irc_cmd_service(struct irc_conn *irc, const char *cmd, const char *Target, const char **args);
 int irc_cmd_time(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
 int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
 int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
--- a/src/protocols/irc/parse.c	Wed Nov 09 00:24:22 2005 +0000
+++ b/src/protocols/irc/parse.c	Wed Nov 09 00:59:09 2005 +0000
@@ -113,6 +113,7 @@
 } _irc_cmds[] = {
 	{ "action", ":", irc_cmd_ctcp_action, N_("action &lt;action to perform&gt;:  Perform an action.") },
 	{ "away", ":", irc_cmd_away, N_("away [message]:  Set an away message, or use no message to return from being away.") },
+	{ "chanserv", ":", irc_cmd_service, N_("chanserv: Send a command to chanserv") },
 	{ "deop", ":", irc_cmd_op, N_("deop &lt;nick1&gt; [nick2] ...:  Remove channel operator status from someone. You must be a channel operator to do this.") },
 	{ "devoice", ":", irc_cmd_op, N_("devoice &lt;nick1&gt; [nick2] ...:  Remove channel voice status from someone, preventing them from speaking if the channel is moderated (+m). You must be a channel operator to do this.") },
 	{ "invite", ":", irc_cmd_invite, N_("invite &lt;nick&gt; [room]:  Invite someone to join you in the specified channel, or the current channel.") },
@@ -121,12 +122,15 @@
 	{ "kick", "n:", irc_cmd_kick, N_("kick &lt;nick&gt; [message]:  Remove someone from a channel. You must be a channel operator to do this.") },
 	{ "list", ":", irc_cmd_list, N_("list:  Display a list of chat rooms on the network. <i>Warning, some servers may disconnect you upon doing this.</i>") },
 	{ "me", ":", irc_cmd_ctcp_action, N_("me &lt;action to perform&gt;:  Perform an action.") },
+	{ "memoserv", ":", irc_cmd_service, N_("memoserv: Send a command to memoserv") },
 	{ "mode", ":", irc_cmd_mode, N_("mode &lt;+|-&gt;&lt;A-Za-z&gt; &lt;nick|channel&gt;:  Set or unset a channel or user mode.") },
 	{ "msg", "t:", irc_cmd_privmsg, N_("msg &lt;nick&gt; &lt;message&gt;:  Send a private message to a user (as opposed to a channel).") },
 	{ "names", "c", irc_cmd_names, N_("names [channel]:  List the users currently in a channel.") },
 	{ "nick", "n", irc_cmd_nick, N_("nick &lt;new nickname&gt;:  Change your nickname.") },
+	{ "nickserv", ":", irc_cmd_service, N_("nickserv: Send a command to nickserv") },
 	{ "op", ":", irc_cmd_op, N_("op &lt;nick1&gt; [nick2] ...:  Grant channel operator status to someone. You must be a channel operator to do this.") },
 	{ "operwall", ":", irc_cmd_wallops, N_("operwall &lt;message&gt;:  If you don't know what this is, you probably can't use it.") },
+	{ "operserv", ":", irc_cmd_service, N_("operserv: Send a command to operserv") },
 	{ "part", "c:", irc_cmd_part, N_("part [room] [message]:  Leave the current channel, or a specified channel, with an optional message.") },
 	{ "ping", "n", irc_cmd_ping, N_("ping [nick]:  Asks how much lag a user (or the server if no user specified) has.") },
 	{ "query", "n:", irc_cmd_query, N_("query &lt;nick&gt; &lt;message&gt;:  Send a private message to a user (as opposed to a channel).") },