# HG changeset patch # User Ethan Blanton # Date 1107274389 0 # Node ID cdeb727d1de3f7c26e047181682f0e7d17ef8408 # Parent 3e2cd3fe889765b7de430fb25570b2e9d2b4cda3 [gaim-migrate @ 11946] IRC TIME support, thanks to Don Seiler committer: Tailor Script diff -r 3e2cd3fe8897 -r cdeb727d1de3 src/protocols/irc/cmds.c --- a/src/protocols/irc/cmds.c Tue Feb 01 05:19:27 2005 +0000 +++ b/src/protocols/irc/cmds.c Tue Feb 01 16:13:09 2005 +0000 @@ -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; diff -r 3e2cd3fe8897 -r cdeb727d1de3 src/protocols/irc/irc.h --- a/src/protocols/irc/irc.h Tue Feb 01 05:19:27 2005 +0000 +++ b/src/protocols/irc/irc.h Tue Feb 01 16:13:09 2005 +0000 @@ -129,6 +129,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); @@ -156,6 +157,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); diff -r 3e2cd3fe8897 -r cdeb727d1de3 src/protocols/irc/msgs.c --- a/src/protocols/irc/msgs.c Tue Feb 01 05:19:27 2005 +0000 +++ b/src/protocols/irc/msgs.c Tue Feb 01 16:13:09 2005 +0000 @@ -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); diff -r 3e2cd3fe8897 -r cdeb727d1de3 src/protocols/irc/parse.c --- a/src/protocols/irc/parse.c Tue Feb 01 05:19:27 2005 +0000 +++ b/src/protocols/irc/parse.c Tue Feb 01 16:13:09 2005 +0000 @@ -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.") },