gaim/gaim

IRC TIME support, thanks to Don Seiler
oldstatus
2005-02-01, Ethan Blanton
b6b253ece9be
Parents 654e33c9fb7c
Children 411d284f7141
IRC TIME support, thanks to Don Seiler
--- a/src/protocols/irc/cmds.c Tue Feb 01 00:18:35 2005 -0500
+++ b/src/protocols/irc/cmds.c Tue Feb 01 11:12:30 2005 -0500
@@ -427,6 +427,17 @@
return 0;
}
+int irc_cmd_time(struct irc_conn *irc, const char *cmd, const char *target, const char **args)
+{
+ char *buf;
+
+ buf = irc_format(irc, "v", "TIME");
+ irc_send(irc, buf);
+ g_free(buf);
+
+ return 0;
+}
+
int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, const char **args)
{
char *buf;
--- a/src/protocols/irc/irc.h Tue Feb 01 00:18:35 2005 -0500
+++ b/src/protocols/irc/irc.h Tue Feb 01 11:12:30 2005 -0500
@@ -126,6 +126,7 @@
void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args);
void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args);
void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args);
+void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args);
void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args);
void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args);
void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args);
@@ -153,6 +154,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_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);
int irc_cmd_whois(struct irc_conn *irc, const char *cmd, const char *target, const char **args);
--- a/src/protocols/irc/msgs.c Tue Feb 01 00:18:35 2005 -0500
+++ b/src/protocols/irc/msgs.c Tue Feb 01 11:12:30 2005 -0500
@@ -417,6 +417,19 @@
irc->timer = gaim_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc);
}
+void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args)
+{
+ GaimConnection *gc;
+
+ gc = gaim_account_get_connection(irc->account);
+ if (gc == NULL || args == NULL || args[2] == NULL)
+ return;
+
+ gaim_notify_message(gc, GAIM_NOTIFY_MSG_INFO, _("Time Response"),
+ _("The IRC server's local time is:"),
+ args[2], NULL, NULL);
+}
+
void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args)
{
GaimConnection *gc = gaim_account_get_connection(irc->account);
--- a/src/protocols/irc/parse.c Tue Feb 01 00:18:35 2005 -0500
+++ b/src/protocols/irc/parse.c Tue Feb 01 11:12:30 2005 -0500
@@ -71,6 +71,7 @@
{ "372", "n:", irc_msg_motd }, /* MOTD */
{ "375", "n:", irc_msg_motd }, /* Start MOTD */
{ "376", "n:", irc_msg_endmotd }, /* End of MOTD */
+ { "391", "nv:", irc_msg_time }, /* Time reply */
{ "401", "nt:", irc_msg_nonick }, /* No such nick/chan */
{ "403", "nc:", irc_msg_nochan }, /* No such channel */
{ "404", "nt:", irc_msg_nosend }, /* Cannot send to chan */
@@ -129,6 +130,7 @@
{ "quit", ":", irc_cmd_quit, N_("quit [message]: Disconnect from the server, with an optional message.") },
{ "quote", "*", irc_cmd_quote, N_("quote [...]: Send a raw command to the server.") },
{ "remove", "n:", irc_cmd_remove, N_("remove <nick> [message]: Remove someone from a room. You must be a channel operator to do this.") },
+ { "time", "", irc_cmd_time, N_("time: Displays the current local time at the IRC server.") },
{ "topic", ":", irc_cmd_topic, N_("topic [new topic]: View or change the channel topic.") },
{ "umode", ":", irc_cmd_mode, N_("umode <+|-><A-Za-z>: Set or unset a user mode.") },
{ "voice", ":", irc_cmd_op, N_("voice <nick1> [nick2] ...: Grant channel voice status to someone. You must be a channel operator to do this.") },