Mercurial > pidgin
changeset 10564:cdeb727d1de3
[gaim-migrate @ 11946]
IRC TIME support, thanks to Don Seiler
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Tue, 01 Feb 2005 16:13:09 +0000 |
parents | 3e2cd3fe8897 |
children | 3b66a8f25bad |
files | src/protocols/irc/cmds.c src/protocols/irc/irc.h src/protocols/irc/msgs.c src/protocols/irc/parse.c |
diffstat | 4 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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);
--- 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);
--- 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.") },