From 2b305f378f9401f6ae4a05673812a8a8eb0f65ac Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Wed, 8 Oct 2003 22:24:23 +0000 Subject: Added commands: service, squit, motd, lusers, links, time, trace and admin --- BUGS | 4 +- ChangeLog | 5 +- src/irc/irc-commands.c | 52 ++++++++++++----- src/irc/irc-send.c | 129 ++++++++++++++++++++++++++++++++++++----- src/irc/irc.h | 15 ++++- weechat/BUGS | 4 +- weechat/ChangeLog | 5 +- weechat/src/irc/irc-commands.c | 52 ++++++++++++----- weechat/src/irc/irc-send.c | 129 ++++++++++++++++++++++++++++++++++++----- weechat/src/irc/irc.h | 15 ++++- 10 files changed, 336 insertions(+), 74 deletions(-) diff --git a/BUGS b/BUGS index 5c38b2ea2..b3ead766f 100644 --- a/BUGS +++ b/BUGS @@ -1,14 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -WeeChat known bugs, 2003-10-05 +WeeChat known bugs, 2003-10-09 - too much nicks in the channel (> height of window) => display bug - some IRC commands are marked as 'unknown' when received (IRC protocol is under dev!) - intercept Ctrl-C (do not quit immediately if Ctrl-C pressed!) -- program is stopped when bad option in config file (it should not, only display - warning) - too much opened channels => display bug - when kicked, channel is not prefixed by '(' and sufixed by ')' - when function key (non used by WeeChat) is pressed, prompt is deleted diff --git a/ChangeLog b/ChangeLog index 127ddc215..56c870738 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2003-10-07 +ChangeLog - 2003-10-09 Version 0.0.3 (under dev!): - * new IRC command: /stats + * new IRC command: /stats, /service, /squit, /motd, /lusers, /links, /time, + /trace, /admin * french translation Version 0.0.2 (2003-10-05): diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c index 384ba787a..3f6972ee6 100644 --- a/src/irc/irc-commands.c +++ b/src/irc/irc-commands.c @@ -24,22 +24,17 @@ RFC 1459,2810,2811,2812 */ -#include -#include -#include -#include -#include -#include - #include "../weechat.h" #include "irc.h" #include "../command.h" -#include "../config.h" -#include "../gui/gui.h" t_irc_command irc_commands[] = -{ { "away", N_("toggle away status"), +{ { "admin", N_("find information about the administrator of the server"), + N_("[target]"), + N_("target: server"), + 0, 1, 1, NULL, irc_cmd_send_admin, NULL }, + { "away", N_("toggle away status"), N_("[-all] [message]"), N_("-all: toggle away status on all connected servers\n" "message: message for away (if no message is given, away status is removed)"), @@ -71,10 +66,20 @@ t_irc_command irc_commands[] = N_("nickname comment"), N_("nickname: nickname\ncomment: comment for kill"), 2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, NULL }, + { "links", N_("list all servernames which are known by the server answering the query"), + N_("[[remove_server] server_mask]"), + N_("remote_server: this server should answer the query\n" + "server_mask: list of servers must match this mask"), + 0, 2, 1, NULL, irc_cmd_send_links, NULL }, { "list", N_("list channels and their topic"), N_("[channel[,channel] [server]]"), N_("channel: channel to list\nserver: server name"), 0, MAX_ARGS, 1, NULL, irc_cmd_send_list, NULL }, + { "lusers", N_("get statistics about ths size of the IRC network"), + N_("[mask [target]]"), + N_("mask: servers matching the mask only\n" + "target: server for forwarding request"), + 0, 2, 1, NULL, irc_cmd_send_lusers, NULL }, { "me", N_("send a ctcp action to the current channel"), N_("message"), N_("message: message to send"), @@ -107,6 +112,10 @@ t_irc_command irc_commands[] = N_("receiver: nick or channel (may be mask, '*' = current channel)" "\ntext: text to send"), 1, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL }, + { "motd", N_("get the \"Message Of The Day\""), + N_("[target]"), + N_("target: server name"), + 0, 1, 1, NULL, irc_cmd_send_motd, NULL }, { "names", N_("list nicknames on channels"), N_("[channel[,channel]]"), N_("channel: channel name"), 0, MAX_ARGS, 1, NULL, irc_cmd_send_names, NULL }, @@ -122,18 +131,18 @@ t_irc_command irc_commands[] = { "oper", N_("get operator privileges"), N_("user password"), N_("user/password: used to get privileges on current IRC server"), - 2, 2, 1, irc_cmd_send_oper, NULL, NULL }, + 2, 2, 1, NULL, irc_cmd_send_oper, NULL }, { "part", N_("leave a channel"), N_("[channel[,channel]]"), N_("channel: channel name to leave"), 0, MAX_ARGS, 1, NULL, irc_cmd_send_part, irc_cmd_recv_part }, { "ping", N_("ping server"), N_("server1 [server2]"), N_("server1: server to ping\nserver2: forward ping to this server"), - 1, 2, 1, irc_cmd_send_ping, NULL, irc_cmd_recv_ping }, + 1, 2, 1, NULL, irc_cmd_send_ping, irc_cmd_recv_ping }, { "pong", N_("answer to a ping message"), N_("daemon [daemon2]"), N_("daemon: daemon who has responded to Ping message\n" "daemon2: forward message to this daemon"), - 1, 2, 1, irc_cmd_send_pong, NULL, NULL }, + 1, 2, 1, NULL, irc_cmd_send_pong, NULL }, { "privmsg", N_("message received"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg }, @@ -151,14 +160,28 @@ t_irc_command irc_commands[] = { "restart", N_("tell the server to restart itself"), "", "", 0, 0, 1, NULL, irc_cmd_send_restart, NULL }, + { "service", N_("register a new service"), + N_("nickname reserved distribution type reserved info"), + N_("distribution: visibility of service\n" + "type: reserved for future usage"), + 6, 6, 1, NULL, irc_cmd_send_service, NULL }, + { "squit", N_("disconnect server links"), + N_("server commnent"), N_("server: server name\ncomment: comment for quit"), + 2, 2, 1, NULL, irc_cmd_send_squit, NULL }, { "stats", N_("query statistics about server"), "[query [server]]", "query: c/h/i/k/l/m/o/y/u (see RFC1459)\nserver: server name", 0, 2, 1, NULL, irc_cmd_send_stats, NULL }, + { "time", N_("query local time from server"), + N_("[target]"), N_("target: query time from specified server"), + 0, 1, 1, NULL, irc_cmd_send_time, NULL }, { "topic", N_("get/set channel topic"), N_("[channel] [topic]"), N_("channel: channel name\ntopic: new topic for channel " "(if topic is \"-delete\" then topic is deleted)"), 0, MAX_ARGS, 1, NULL, irc_cmd_send_topic, irc_cmd_recv_topic }, + { "trace", N_("find the route to specific server"), + N_("[target]"), N_("target: server"), + 0, 1, 1, NULL, irc_cmd_send_trace, NULL }, { "version", N_("gives the version info of nick or server (current or specified)"), N_("[server | nickname]"), N_("server: server name\nnickname: nickname"), 0, 1, 1, NULL, irc_cmd_send_version, NULL }, @@ -222,6 +245,8 @@ t_irc_command irc_commands[] = N_("channel :[[@|+]nick ...]"), N_("channel: name of channel\nnick: nick on the channel"), 2, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_353 }, + { "364", N_("links"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, + { "365", N_("end of /links list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "366", N_("end of /names list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_366 }, { "371", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "372", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, @@ -229,6 +254,7 @@ t_irc_command irc_commands[] = { "374", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, + { "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "401", N_("no such nick/channel"), "", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, { "402", N_("no such server"), diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c index d086aee29..b8d25399f 100644 --- a/src/irc/irc-send.c +++ b/src/irc/irc-send.c @@ -64,6 +64,20 @@ irc_login (t_irc_server *server) server->realname); } +/* + * irc_cmd_send_admin: find information about the administrator of the server + */ + +int +irc_cmd_send_admin (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "ADMIN %s\r\n", arguments); + else + server_sendf (server, "ADMIN\r\n"); + return 0; +} + /* * irc_cmd_send_away: toggle away status */ @@ -264,6 +278,21 @@ irc_cmd_send_kill (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_links: list all servernames which are known by the server + * answering the query + */ + +int +irc_cmd_send_links (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "LINKS %s\r\n", arguments); + else + server_sendf (server, "LINKS\r\n"); + return 0; +} + /* * irc_cmd_send_list: close client-server connection */ @@ -278,6 +307,20 @@ irc_cmd_send_list (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_lusers: get statistics about ths size of the IRC network + */ + +int +irc_cmd_send_lusers (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "LUSERS %s\r\n", arguments); + else + server_sendf (server, "LUSERS\r\n"); + return 0; +} + /* * irc_cmd_send_me: send a ctcp action to the current channel */ @@ -434,6 +477,20 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_motd: get the "Message Of The Day" + */ + +int +irc_cmd_send_motd (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "MOTD %s\r\n", arguments); + else + server_sendf (server, "MOTD\r\n"); + return 0; +} + /* * irc_cmd_send_names: list nicknames on channels */ @@ -514,11 +571,9 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv) */ int -irc_cmd_send_oper (t_irc_server *server, int argc, char **argv) +irc_cmd_send_oper (t_irc_server *server, char *arguments) { - if (argc != 2) - return -1; - server_sendf (server, "OPER %s %s\r\n", argv[0], argv[1]); + server_sendf (server, "OPER %s %s\r\n", arguments); return 0; } @@ -593,13 +648,9 @@ irc_cmd_send_part (t_irc_server *server, char *arguments) */ int -irc_cmd_send_ping (t_irc_server *server, int argc, char **argv) +irc_cmd_send_ping (t_irc_server *server, char *arguments) { - if (argc == 1) - server_sendf (server, "PING %s\r\n", argv[0]); - if (argc == 2) - server_sendf (server, "PING %s %s\r\n", argv[0], - argv[1]); + server_sendf (server, "PING %s\r\n", arguments); return 0; } @@ -608,13 +659,9 @@ irc_cmd_send_ping (t_irc_server *server, int argc, char **argv) */ int -irc_cmd_send_pong (t_irc_server *server, int argc, char **argv) +irc_cmd_send_pong (t_irc_server *server, char *arguments) { - if (argc == 1) - server_sendf (server, "PONG %s\r\n", argv[0]); - if (argc == 2) - server_sendf (server, "PONG %s %s\r\n", argv[0], - argv[1]); + server_sendf (server, "PONG %s\r\n", arguments); return 0; } @@ -675,6 +722,28 @@ irc_cmd_send_restart (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_service: register a new service + */ + +int +irc_cmd_send_service (t_irc_server *server, char *arguments) +{ + server_sendf (server, "SERVICE %s\r\n", arguments); + return 0; +} + +/* + * irc_cmd_send_squit: disconnect server links + */ + +int +irc_cmd_send_squit (t_irc_server *server, char *arguments) +{ + server_sendf (server, "SQUIT %s\r\n", arguments); + return 0; +} + /* * irc_cmd_send_stats: query statistics about server */ @@ -689,6 +758,20 @@ irc_cmd_send_stats (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_time: query local time from server + */ + +int +irc_cmd_send_time (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "TIME %s\r\n", arguments); + else + server_sendf (server, "TIME\r\n"); + return 0; +} + /* * irc_cmd_send_topic: get/set topic for a channel */ @@ -745,6 +828,20 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_trace: find the route to specific server + */ + +int +irc_cmd_send_trace (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "TRACE %s\r\n", arguments); + else + server_sendf (server, "TRACE\r\n"); + return 0; +} + /* * irc_cmd_send_version: gives the version info of nick or server (current or specified) */ diff --git a/src/irc/irc.h b/src/irc/irc.h index 0dfa33ac4..3474c4b95 100644 --- a/src/irc/irc.h +++ b/src/irc/irc.h @@ -188,6 +188,7 @@ extern void irc_display_mode (t_gui_window *, char *, char, char *, char *, extern int irc_recv_command (t_irc_server *, char *, char *, char *); extern void irc_login (t_irc_server *); /* IRC commands issued by user */ +extern int irc_cmd_send_admin (t_irc_server *, char *); extern int irc_cmd_send_away (t_irc_server *, char *); extern int irc_cmd_send_ctcp (t_irc_server *, char *); extern int irc_cmd_send_deop (t_irc_server *, int, char **); @@ -196,24 +197,31 @@ extern int irc_cmd_send_invite (t_irc_server *, char *); extern int irc_cmd_send_join (t_irc_server *, char *); extern int irc_cmd_send_kick (t_irc_server *, char *); extern int irc_cmd_send_kill (t_irc_server *, char *); +extern int irc_cmd_send_links (t_irc_server *, char *); extern int irc_cmd_send_list (t_irc_server *, char *); +extern int irc_cmd_send_lusers (t_irc_server *, char *); extern int irc_cmd_send_me (t_irc_server *, char *); extern int irc_cmd_send_mode (t_irc_server *, char *); extern int irc_cmd_send_msg (t_irc_server *, char *); +extern int irc_cmd_send_motd (t_irc_server *, char *); extern int irc_cmd_send_names (t_irc_server *, char *); extern int irc_cmd_send_nick (t_irc_server *, int, char **); extern int irc_cmd_send_notice (t_irc_server *, char *); extern int irc_cmd_send_op (t_irc_server *, int, char **); -extern int irc_cmd_send_oper (t_irc_server *, int, char **); +extern int irc_cmd_send_oper (t_irc_server *, char *); extern int irc_cmd_send_part (t_irc_server *, char *); -extern int irc_cmd_send_ping (t_irc_server *, int, char **); -extern int irc_cmd_send_pong (t_irc_server *, int, char **); +extern int irc_cmd_send_ping (t_irc_server *, char *); +extern int irc_cmd_send_pong (t_irc_server *, char *); extern int irc_cmd_send_quit (t_irc_server *, char *); extern int irc_cmd_send_quote (t_irc_server *, char *); extern int irc_cmd_send_rehash (t_irc_server *, char *); extern int irc_cmd_send_restart (t_irc_server *, char *); +extern int irc_cmd_send_service (t_irc_server *, char *); +extern int irc_cmd_send_squit (t_irc_server *, char *); extern int irc_cmd_send_stats (t_irc_server *, char *); +extern int irc_cmd_send_time (t_irc_server *, char *); extern int irc_cmd_send_topic (t_irc_server *, char *); +extern int irc_cmd_send_trace (t_irc_server *, char *); extern int irc_cmd_send_version (t_irc_server *, char *); extern int irc_cmd_send_voice (t_irc_server *, int, char **); extern int irc_cmd_send_whois (t_irc_server *, char *); @@ -249,6 +257,7 @@ extern int irc_cmd_recv_332 (t_irc_server *, char *, char *); extern int irc_cmd_recv_333 (t_irc_server *, char *, char *); extern int irc_cmd_recv_351 (t_irc_server *, char *, char *); extern int irc_cmd_recv_353 (t_irc_server *, char *, char *); +extern int irc_cmd_recv_365 (t_irc_server *, char *, char *); extern int irc_cmd_recv_366 (t_irc_server *, char *, char *); extern int irc_cmd_recv_433 (t_irc_server *, char *, char *); diff --git a/weechat/BUGS b/weechat/BUGS index 5c38b2ea2..b3ead766f 100644 --- a/weechat/BUGS +++ b/weechat/BUGS @@ -1,14 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -WeeChat known bugs, 2003-10-05 +WeeChat known bugs, 2003-10-09 - too much nicks in the channel (> height of window) => display bug - some IRC commands are marked as 'unknown' when received (IRC protocol is under dev!) - intercept Ctrl-C (do not quit immediately if Ctrl-C pressed!) -- program is stopped when bad option in config file (it should not, only display - warning) - too much opened channels => display bug - when kicked, channel is not prefixed by '(' and sufixed by ')' - when function key (non used by WeeChat) is pressed, prompt is deleted diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 127ddc215..56c870738 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,11 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2003-10-07 +ChangeLog - 2003-10-09 Version 0.0.3 (under dev!): - * new IRC command: /stats + * new IRC command: /stats, /service, /squit, /motd, /lusers, /links, /time, + /trace, /admin * french translation Version 0.0.2 (2003-10-05): diff --git a/weechat/src/irc/irc-commands.c b/weechat/src/irc/irc-commands.c index 384ba787a..3f6972ee6 100644 --- a/weechat/src/irc/irc-commands.c +++ b/weechat/src/irc/irc-commands.c @@ -24,22 +24,17 @@ RFC 1459,2810,2811,2812 */ -#include -#include -#include -#include -#include -#include - #include "../weechat.h" #include "irc.h" #include "../command.h" -#include "../config.h" -#include "../gui/gui.h" t_irc_command irc_commands[] = -{ { "away", N_("toggle away status"), +{ { "admin", N_("find information about the administrator of the server"), + N_("[target]"), + N_("target: server"), + 0, 1, 1, NULL, irc_cmd_send_admin, NULL }, + { "away", N_("toggle away status"), N_("[-all] [message]"), N_("-all: toggle away status on all connected servers\n" "message: message for away (if no message is given, away status is removed)"), @@ -71,10 +66,20 @@ t_irc_command irc_commands[] = N_("nickname comment"), N_("nickname: nickname\ncomment: comment for kill"), 2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, NULL }, + { "links", N_("list all servernames which are known by the server answering the query"), + N_("[[remove_server] server_mask]"), + N_("remote_server: this server should answer the query\n" + "server_mask: list of servers must match this mask"), + 0, 2, 1, NULL, irc_cmd_send_links, NULL }, { "list", N_("list channels and their topic"), N_("[channel[,channel] [server]]"), N_("channel: channel to list\nserver: server name"), 0, MAX_ARGS, 1, NULL, irc_cmd_send_list, NULL }, + { "lusers", N_("get statistics about ths size of the IRC network"), + N_("[mask [target]]"), + N_("mask: servers matching the mask only\n" + "target: server for forwarding request"), + 0, 2, 1, NULL, irc_cmd_send_lusers, NULL }, { "me", N_("send a ctcp action to the current channel"), N_("message"), N_("message: message to send"), @@ -107,6 +112,10 @@ t_irc_command irc_commands[] = N_("receiver: nick or channel (may be mask, '*' = current channel)" "\ntext: text to send"), 1, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL }, + { "motd", N_("get the \"Message Of The Day\""), + N_("[target]"), + N_("target: server name"), + 0, 1, 1, NULL, irc_cmd_send_motd, NULL }, { "names", N_("list nicknames on channels"), N_("[channel[,channel]]"), N_("channel: channel name"), 0, MAX_ARGS, 1, NULL, irc_cmd_send_names, NULL }, @@ -122,18 +131,18 @@ t_irc_command irc_commands[] = { "oper", N_("get operator privileges"), N_("user password"), N_("user/password: used to get privileges on current IRC server"), - 2, 2, 1, irc_cmd_send_oper, NULL, NULL }, + 2, 2, 1, NULL, irc_cmd_send_oper, NULL }, { "part", N_("leave a channel"), N_("[channel[,channel]]"), N_("channel: channel name to leave"), 0, MAX_ARGS, 1, NULL, irc_cmd_send_part, irc_cmd_recv_part }, { "ping", N_("ping server"), N_("server1 [server2]"), N_("server1: server to ping\nserver2: forward ping to this server"), - 1, 2, 1, irc_cmd_send_ping, NULL, irc_cmd_recv_ping }, + 1, 2, 1, NULL, irc_cmd_send_ping, irc_cmd_recv_ping }, { "pong", N_("answer to a ping message"), N_("daemon [daemon2]"), N_("daemon: daemon who has responded to Ping message\n" "daemon2: forward message to this daemon"), - 1, 2, 1, irc_cmd_send_pong, NULL, NULL }, + 1, 2, 1, NULL, irc_cmd_send_pong, NULL }, { "privmsg", N_("message received"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg }, @@ -151,14 +160,28 @@ t_irc_command irc_commands[] = { "restart", N_("tell the server to restart itself"), "", "", 0, 0, 1, NULL, irc_cmd_send_restart, NULL }, + { "service", N_("register a new service"), + N_("nickname reserved distribution type reserved info"), + N_("distribution: visibility of service\n" + "type: reserved for future usage"), + 6, 6, 1, NULL, irc_cmd_send_service, NULL }, + { "squit", N_("disconnect server links"), + N_("server commnent"), N_("server: server name\ncomment: comment for quit"), + 2, 2, 1, NULL, irc_cmd_send_squit, NULL }, { "stats", N_("query statistics about server"), "[query [server]]", "query: c/h/i/k/l/m/o/y/u (see RFC1459)\nserver: server name", 0, 2, 1, NULL, irc_cmd_send_stats, NULL }, + { "time", N_("query local time from server"), + N_("[target]"), N_("target: query time from specified server"), + 0, 1, 1, NULL, irc_cmd_send_time, NULL }, { "topic", N_("get/set channel topic"), N_("[channel] [topic]"), N_("channel: channel name\ntopic: new topic for channel " "(if topic is \"-delete\" then topic is deleted)"), 0, MAX_ARGS, 1, NULL, irc_cmd_send_topic, irc_cmd_recv_topic }, + { "trace", N_("find the route to specific server"), + N_("[target]"), N_("target: server"), + 0, 1, 1, NULL, irc_cmd_send_trace, NULL }, { "version", N_("gives the version info of nick or server (current or specified)"), N_("[server | nickname]"), N_("server: server name\nnickname: nickname"), 0, 1, 1, NULL, irc_cmd_send_version, NULL }, @@ -222,6 +245,8 @@ t_irc_command irc_commands[] = N_("channel :[[@|+]nick ...]"), N_("channel: name of channel\nnick: nick on the channel"), 2, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_353 }, + { "364", N_("links"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, + { "365", N_("end of /links list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "366", N_("end of /names list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_366 }, { "371", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "372", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, @@ -229,6 +254,7 @@ t_irc_command irc_commands[] = { "374", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, + { "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg }, { "401", N_("no such nick/channel"), "", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error }, { "402", N_("no such server"), diff --git a/weechat/src/irc/irc-send.c b/weechat/src/irc/irc-send.c index d086aee29..b8d25399f 100644 --- a/weechat/src/irc/irc-send.c +++ b/weechat/src/irc/irc-send.c @@ -64,6 +64,20 @@ irc_login (t_irc_server *server) server->realname); } +/* + * irc_cmd_send_admin: find information about the administrator of the server + */ + +int +irc_cmd_send_admin (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "ADMIN %s\r\n", arguments); + else + server_sendf (server, "ADMIN\r\n"); + return 0; +} + /* * irc_cmd_send_away: toggle away status */ @@ -264,6 +278,21 @@ irc_cmd_send_kill (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_links: list all servernames which are known by the server + * answering the query + */ + +int +irc_cmd_send_links (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "LINKS %s\r\n", arguments); + else + server_sendf (server, "LINKS\r\n"); + return 0; +} + /* * irc_cmd_send_list: close client-server connection */ @@ -278,6 +307,20 @@ irc_cmd_send_list (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_lusers: get statistics about ths size of the IRC network + */ + +int +irc_cmd_send_lusers (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "LUSERS %s\r\n", arguments); + else + server_sendf (server, "LUSERS\r\n"); + return 0; +} + /* * irc_cmd_send_me: send a ctcp action to the current channel */ @@ -434,6 +477,20 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_motd: get the "Message Of The Day" + */ + +int +irc_cmd_send_motd (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "MOTD %s\r\n", arguments); + else + server_sendf (server, "MOTD\r\n"); + return 0; +} + /* * irc_cmd_send_names: list nicknames on channels */ @@ -514,11 +571,9 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv) */ int -irc_cmd_send_oper (t_irc_server *server, int argc, char **argv) +irc_cmd_send_oper (t_irc_server *server, char *arguments) { - if (argc != 2) - return -1; - server_sendf (server, "OPER %s %s\r\n", argv[0], argv[1]); + server_sendf (server, "OPER %s %s\r\n", arguments); return 0; } @@ -593,13 +648,9 @@ irc_cmd_send_part (t_irc_server *server, char *arguments) */ int -irc_cmd_send_ping (t_irc_server *server, int argc, char **argv) +irc_cmd_send_ping (t_irc_server *server, char *arguments) { - if (argc == 1) - server_sendf (server, "PING %s\r\n", argv[0]); - if (argc == 2) - server_sendf (server, "PING %s %s\r\n", argv[0], - argv[1]); + server_sendf (server, "PING %s\r\n", arguments); return 0; } @@ -608,13 +659,9 @@ irc_cmd_send_ping (t_irc_server *server, int argc, char **argv) */ int -irc_cmd_send_pong (t_irc_server *server, int argc, char **argv) +irc_cmd_send_pong (t_irc_server *server, char *arguments) { - if (argc == 1) - server_sendf (server, "PONG %s\r\n", argv[0]); - if (argc == 2) - server_sendf (server, "PONG %s %s\r\n", argv[0], - argv[1]); + server_sendf (server, "PONG %s\r\n", arguments); return 0; } @@ -675,6 +722,28 @@ irc_cmd_send_restart (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_service: register a new service + */ + +int +irc_cmd_send_service (t_irc_server *server, char *arguments) +{ + server_sendf (server, "SERVICE %s\r\n", arguments); + return 0; +} + +/* + * irc_cmd_send_squit: disconnect server links + */ + +int +irc_cmd_send_squit (t_irc_server *server, char *arguments) +{ + server_sendf (server, "SQUIT %s\r\n", arguments); + return 0; +} + /* * irc_cmd_send_stats: query statistics about server */ @@ -689,6 +758,20 @@ irc_cmd_send_stats (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_time: query local time from server + */ + +int +irc_cmd_send_time (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "TIME %s\r\n", arguments); + else + server_sendf (server, "TIME\r\n"); + return 0; +} + /* * irc_cmd_send_topic: get/set topic for a channel */ @@ -745,6 +828,20 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments) return 0; } +/* + * irc_cmd_send_trace: find the route to specific server + */ + +int +irc_cmd_send_trace (t_irc_server *server, char *arguments) +{ + if (arguments) + server_sendf (server, "TRACE %s\r\n", arguments); + else + server_sendf (server, "TRACE\r\n"); + return 0; +} + /* * irc_cmd_send_version: gives the version info of nick or server (current or specified) */ diff --git a/weechat/src/irc/irc.h b/weechat/src/irc/irc.h index 0dfa33ac4..3474c4b95 100644 --- a/weechat/src/irc/irc.h +++ b/weechat/src/irc/irc.h @@ -188,6 +188,7 @@ extern void irc_display_mode (t_gui_window *, char *, char, char *, char *, extern int irc_recv_command (t_irc_server *, char *, char *, char *); extern void irc_login (t_irc_server *); /* IRC commands issued by user */ +extern int irc_cmd_send_admin (t_irc_server *, char *); extern int irc_cmd_send_away (t_irc_server *, char *); extern int irc_cmd_send_ctcp (t_irc_server *, char *); extern int irc_cmd_send_deop (t_irc_server *, int, char **); @@ -196,24 +197,31 @@ extern int irc_cmd_send_invite (t_irc_server *, char *); extern int irc_cmd_send_join (t_irc_server *, char *); extern int irc_cmd_send_kick (t_irc_server *, char *); extern int irc_cmd_send_kill (t_irc_server *, char *); +extern int irc_cmd_send_links (t_irc_server *, char *); extern int irc_cmd_send_list (t_irc_server *, char *); +extern int irc_cmd_send_lusers (t_irc_server *, char *); extern int irc_cmd_send_me (t_irc_server *, char *); extern int irc_cmd_send_mode (t_irc_server *, char *); extern int irc_cmd_send_msg (t_irc_server *, char *); +extern int irc_cmd_send_motd (t_irc_server *, char *); extern int irc_cmd_send_names (t_irc_server *, char *); extern int irc_cmd_send_nick (t_irc_server *, int, char **); extern int irc_cmd_send_notice (t_irc_server *, char *); extern int irc_cmd_send_op (t_irc_server *, int, char **); -extern int irc_cmd_send_oper (t_irc_server *, int, char **); +extern int irc_cmd_send_oper (t_irc_server *, char *); extern int irc_cmd_send_part (t_irc_server *, char *); -extern int irc_cmd_send_ping (t_irc_server *, int, char **); -extern int irc_cmd_send_pong (t_irc_server *, int, char **); +extern int irc_cmd_send_ping (t_irc_server *, char *); +extern int irc_cmd_send_pong (t_irc_server *, char *); extern int irc_cmd_send_quit (t_irc_server *, char *); extern int irc_cmd_send_quote (t_irc_server *, char *); extern int irc_cmd_send_rehash (t_irc_server *, char *); extern int irc_cmd_send_restart (t_irc_server *, char *); +extern int irc_cmd_send_service (t_irc_server *, char *); +extern int irc_cmd_send_squit (t_irc_server *, char *); extern int irc_cmd_send_stats (t_irc_server *, char *); +extern int irc_cmd_send_time (t_irc_server *, char *); extern int irc_cmd_send_topic (t_irc_server *, char *); +extern int irc_cmd_send_trace (t_irc_server *, char *); extern int irc_cmd_send_version (t_irc_server *, char *); extern int irc_cmd_send_voice (t_irc_server *, int, char **); extern int irc_cmd_send_whois (t_irc_server *, char *); @@ -249,6 +257,7 @@ extern int irc_cmd_recv_332 (t_irc_server *, char *, char *); extern int irc_cmd_recv_333 (t_irc_server *, char *, char *); extern int irc_cmd_recv_351 (t_irc_server *, char *, char *); extern int irc_cmd_recv_353 (t_irc_server *, char *, char *); +extern int irc_cmd_recv_365 (t_irc_server *, char *, char *); extern int irc_cmd_recv_366 (t_irc_server *, char *, char *); extern int irc_cmd_recv_433 (t_irc_server *, char *, char *); -- cgit v1.2.3