summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-07-17 11:03:00 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-07-17 11:03:00 +0000
commitbdf9eadf437cb7a146dcde51560a0cde93cec5b7 (patch)
tree36b12309d419c677f6583c94d307cf4685158bbe /src
parent15ea11b57b86ff806d956d218bd63d8239659b73 (diff)
downloadweechat-bdf9eadf437cb7a146dcde51560a0cde93cec5b7.zip
Fixed /ctcp command (now any command/data allowed)
Diffstat (limited to 'src')
-rw-r--r--src/common/completion.c3
-rw-r--r--src/irc/irc-commands.c213
-rw-r--r--src/irc/irc-recv.c72
-rw-r--r--src/irc/irc-send.c79
4 files changed, 234 insertions, 133 deletions
diff --git a/src/common/completion.c b/src/common/completion.c
index fa45cfe45..4303eedc2 100644
--- a/src/common/completion.c
+++ b/src/common/completion.c
@@ -426,6 +426,9 @@ completion_build_list (t_completion *completion, void *channel)
"action");
weelist_add (&completion->completion_list,
&completion->last_completion,
+ "ping");
+ weelist_add (&completion->completion_list,
+ &completion->last_completion,
"version");
return;
}
diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c
index 4c95fcc74..0a1a1a69a 100644
--- a/src/irc/irc-commands.c
+++ b/src/irc/irc-commands.c
@@ -46,11 +46,14 @@ t_irc_command irc_commands[] =
0, MAX_ARGS, 1, NULL, irc_cmd_send_away, NULL },
{ "ban", N_("bans nicks or hosts"),
N_("[channel] [nickname [nickname ...]]"),
- N_("channel: channel for ban\nnickname: user or host to ban"),
+ N_("channel: channel for ban\n"
+ "nickname: user or host to ban"),
0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
- { "ctcp", N_("send a ctcp message"),
- N_("nickname type"),
- N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
+ { "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"),
+ N_("nickname type [arguments]"),
+ N_("nickname: user to send CTCP to\n"
+ "type: CTCP type (examples: \"version\", \"ping\", ..)\n"
+ "arguments: arguments for CTCP"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
{ "dcc", N_("starts DCC (file or chat) or close chat"),
N_("action [nickname [file]]"),
@@ -80,7 +83,8 @@ t_irc_command irc_commands[] =
0, 1, 1, NULL, irc_cmd_send_info, NULL },
{ "invite", N_("invite a nick on a channel"),
N_("nickname channel"),
- N_("nickname: nick to invite\nchannel: channel to invite"),
+ N_("nickname: nick to invite\n"
+ "channel: channel to invite"),
1, 2, 1, irc_cmd_send_invite, NULL, irc_cmd_recv_invite },
{ "ison", N_("check if a nickname is currently on IRC"),
N_("nickname [nickname ...]"),
@@ -88,19 +92,25 @@ t_irc_command irc_commands[] =
1, MAX_ARGS, 1, NULL, irc_cmd_send_ison, NULL },
{ "join", N_("join a channel"),
N_("channel[,channel] [key[,key]]"),
- N_("channel: channel name to join\nkey: key to join the channel"),
+ N_("channel: channel name to join\n"
+ "key: key to join the channel"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_join, irc_cmd_recv_join },
{ "kick", N_("forcibly remove a user from a channel"),
N_("[channel] nickname [comment]"),
- N_("channel: channel where user is\nnickname: nickname to kick\ncomment: comment for kick"),
+ N_("channel: channel where user is\n"
+ "nickname: nickname to kick\n"
+ "comment: comment for kick"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_kick, irc_cmd_recv_kick },
{ "kickban", N_("kicks and bans a nick from a channel"),
N_("[channel] nickname [comment]"),
- N_("channel: channel where user is\nnickname: nickname to kick and ban\ncomment: comment for kick"),
+ N_("channel: channel where user is\n"
+ "nickname: nickname to kick and ban\n"
+ "comment: comment for kick"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_kickban, NULL },
{ "kill", N_("close client-server connection"),
N_("nickname comment"),
- N_("nickname: nickname\ncomment: comment for kill"),
+ N_("nickname: nickname\n"
+ "comment: comment for kill"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, irc_cmd_recv_kill },
{ "links", N_("list all servernames which are known by the server answering the query"),
N_("[[server] server_mask]"),
@@ -149,8 +159,8 @@ t_irc_command irc_commands[] =
0, 1, 1, NULL, irc_cmd_send_motd, NULL },
{ "msg", N_("send message to a nick or channel"),
N_("receiver[,receiver] text"),
- N_("receiver: nick or channel (may be mask, '*' = current channel)"
- "\ntext: text to send"),
+ N_("receiver: nick or channel (may be mask, '*' = current channel)\n"
+ "text: text to send"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL },
{ "names", N_("list nicknames on channels"),
N_("[channel[,channel]]"), N_("channel: channel name"),
@@ -171,24 +181,26 @@ t_irc_command irc_commands[] =
N_("user/password: used to get privileges on current IRC server"),
2, 2, 1, NULL, irc_cmd_send_oper, NULL },
{ "part", N_("leave a channel"),
- N_("[channel[,channel]] [part_message]"), N_("channel: channel name to leave\n"
- "part_message: part message (displayed to other users)"),
+ N_("[channel[,channel]] [part_message]"),
+ N_("channel: channel name to leave\n"
+ "part_message: part message (displayed to other users)"),
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, 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"),
+ N_("daemon [daemon2]"),
+ N_("daemon: daemon who has responded to Ping message\n"
+ "daemon2: forward message to this daemon"),
1, 2, 1, NULL, irc_cmd_send_pong, irc_cmd_recv_pong },
{ "privmsg", N_("message received"),
"", "",
0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg },
{ "query", N_("send a private message to a nick"),
N_("nickname [text]"),
- N_("nickname: nickname for private conversation"
- "\ntext: text to send"),
+ N_("nickname: nickname for private conversation\n"
+ "text: text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_query, NULL },
{ "quit", N_("close all connections & quit"),
N_("[quit_message]"),
@@ -210,14 +222,17 @@ t_irc_command irc_commands[] =
"type: reserved for future usage"),
6, 6, 1, NULL, irc_cmd_send_service, NULL },
{ "servlist", N_("list services currently connected to the network"),
- N_("[mask [type]]"), N_("mask: list only services matching this mask\n"
- "type: list only services of this type"),
+ N_("[mask [type]]"),
+ N_("mask: list only services matching this mask\n"
+ "type: list only services of this type"),
0, 2, 1, NULL, irc_cmd_send_servlist, NULL },
{ "squery", N_("deliver a message to a service"),
- N_("service text"), N_("service: name of service\ntext: text to send"),
+ N_("service text"),
+ N_("service: name of service\ntext: text to send"),
2, 2, 1, NULL, irc_cmd_send_squery, NULL },
{ "squit", N_("disconnect server links"),
- N_("server comment"), N_("server: server name\ncomment: comment for quit"),
+ N_("server comment"),
+ N_("server: server name\ncomment: comment for quit"),
2, 2, 1, NULL, irc_cmd_send_squit, NULL },
{ "stats", N_("query statistics about server"),
N_("[query [server]]"),
@@ -226,21 +241,24 @@ t_irc_command irc_commands[] =
{ "summon", N_("give users who are on a host running an IRC server a message "
"asking them to please join IRC"),
N_("user [target [channel]]"),
- N_("user: username\ntarget: server name\nchannel: channel name"),
+ N_("user: username\ntarget: server name\n"
+ "channel: channel name"),
1, 3, 1, NULL, irc_cmd_send_summon, 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)"),
+ 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 },
{ "unban", N_("unbans nicks or hosts"),
N_("[channel] nickname [nickname ...]"),
- N_("channel: channel for unban\nnickname: user or host to unban"),
+ N_("channel: channel for unban\n"
+ "nickname: user or host to unban"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_unban, NULL },
{ "userhost", N_("return a list of information about nicknames"),
N_("nickname [nickname ...]"), N_("nickname: nickname"),
@@ -249,7 +267,9 @@ t_irc_command irc_commands[] =
N_("[target]"), N_("target: server"),
0, 1, 1, NULL, irc_cmd_send_users, NULL },
{ "version", N_("gives the version info of nick or server (current or specified)"),
- N_("[server | nickname]"), N_("server: server name\nnickname: nickname"),
+ N_("[server | nickname]"),
+ N_("server: server name\n"
+ "nickname: nickname"),
0, 1, 1, NULL, irc_cmd_send_version, NULL },
{ "voice", N_("gives voice to nickname(s)"),
N_("nickname [nickname]"), "",
@@ -259,70 +279,73 @@ t_irc_command irc_commands[] =
N_("text"), N_("text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_wallops, NULL },
{ "who", N_("generate a query which returns a list of information"),
- N_("[mask [\"o\"]]"), N_("mask: only information which match this mask\n"
- "o: only operators are returned according to the mask supplied"),
+ N_("[mask [\"o\"]]"),
+ N_("mask: only information which match this mask\n"
+ "o: only operators are returned according to the mask supplied"),
0, 2, 1, NULL, irc_cmd_send_who, NULL },
{ "whois", N_("query information about user(s)"),
- N_("[server] nickname[,nickname]"), N_("server: server name\n"
- "nickname: nickname (may be a mask)"),
+ N_("[server] nickname[,nickname]"),
+ N_("server: server name\n"
+ "nickname: nickname (may be a mask)"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_whois, NULL },
{ "whowas", N_("ask for information about a nickname which no longer exists"),
N_("nickname [,nickname [,nickname ...]] [count [target]]"),
- N_("nickname: nickname to search\ncount: number of replies to return "
- "(full search if negative number)\n"
- "target: reply should match this mask"),
+ N_("nickname: nickname to search\n"
+ "count: number of replies to return (full search if negative number)\n"
+ "target: reply should match this mask"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_whowas, NULL },
- { "001", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "002", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "003", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "004", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_004 },
- { "005", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "212", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "219", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "250", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "251", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "252", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "253", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "254", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "255", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "256", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "257", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "258", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "259", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "260", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "261", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "262", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "263", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "264", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "265", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "266", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "267", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "268", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "269", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "301", N_("away message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_301 },
- { "302", N_("userhost"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_302 },
- { "303", N_("ison"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_303 },
- { "305", N_("unaway"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_305 },
- { "306", N_("now away"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_306 },
+ { "001", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "002", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "003", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "004", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_004 },
+ { "005", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "212", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "219", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "250", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "251", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "252", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "253", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "254", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "255", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "256", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "257", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "258", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "259", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "260", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "261", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "262", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "263", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "264", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "265", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "266", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "267", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "268", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "269", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "301", N_("away message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_301 },
+ { "302", N_("userhost"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_302 },
+ { "303", N_("ison"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_303 },
+ { "305", N_("unaway"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_305 },
+ { "306", N_("now away"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_306 },
{ "307", N_("whois (registered nick)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_307 },
- { "311", N_("whois (user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_311 },
- { "312", N_("whois (server)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_312 },
- { "313", N_("whois (operator)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_313 },
- { "314", N_("whowas"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_314 },
- { "315", N_("end of /who list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_315 },
- { "317", N_("whois (idle)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_317 },
- { "318", N_("whois (end)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_318 },
- { "319", N_("whois (channels)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_319 },
+ { "311", N_("whois (user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_311 },
+ { "312", N_("whois (server)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_312 },
+ { "313", N_("whois (operator)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_313 },
+ { "314", N_("whowas"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_314 },
+ { "315", N_("end of /who list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_315 },
+ { "317", N_("whois (idle)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_317 },
+ { "318", N_("whois (end)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_318 },
+ { "319", N_("whois (channels)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_319 },
{ "320", N_("whois (identified user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_320 },
- { "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
- { "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
- { "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
- { "324", N_("channel mode"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_324 },
- { "329", "???", "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_329 },
- { "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
+ { "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
+ { "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
+ { "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
+ { "324", N_("channel mode"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_324 },
+ { "329", "???", "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_329 },
+ { "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
{ "332", N_("topic of channel"),
N_("channel :topic"),
- N_("channel: name of channel\ntopic: topic of the channel"),
+ N_("channel: name of channel\n"
+ "topic: topic of the channel"),
2, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_332 },
{ "333", N_("infos about topic (nick & date changed)"),
"", "",
@@ -332,21 +355,22 @@ t_irc_command irc_commands[] =
{ "352", N_("who"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_352 },
{ "353", N_("list of nicks on channel"),
N_("channel :[[@|+]nick ...]"),
- N_("channel: name of channel\nnick: nick on the channel"),
+ N_("channel: name of channel\n"
+ "nick: 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 },
- { "367", N_("banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_367 },
- { "368", N_("end of banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_368 },
+ { "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 },
+ { "367", N_("banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_367 },
+ { "368", N_("end of banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_368 },
{ "369", N_("end of /whowas list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "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 },
- { "373", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
- { "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 },
+ { "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 },
+ { "373", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "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"),
@@ -447,6 +471,7 @@ t_irc_command irc_commands[] =
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "502", N_("can't change mode for other users"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
- { "671", N_("whois (secure connection)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_671 },
+ { "671", N_("whois (secure connection)"),
+ "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_671 },
{ NULL, NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL }
};
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index 66edef086..41e6cc04f 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -1260,7 +1260,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
- irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
gui_printf (ptr_channel->buffer,
_("Received a CTCP SOUND \"%s\" from "),
pos);
@@ -1322,8 +1322,19 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos++;
/* version asked by another user => answer with WeeChat version */
- if (strcmp (pos, "\01VERSION\01") == 0)
+ if (strncmp (pos, "\01VERSION", 8) == 0)
{
+ pos2 = strchr (pos + 8, ' ');
+ if (pos2)
+ {
+ while (pos2[0] == ' ')
+ pos2++;
+ if (pos2[0] == '\01')
+ pos2 = NULL;
+ else if (!pos2[0])
+ pos2 = NULL;
+ }
+
buf = (struct utsname *) malloc (sizeof (struct utsname));
if (buf && (uname (buf) == 0))
{
@@ -1342,15 +1353,20 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
" compiled on %s%s",
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
"\01\r\n");
- irc_display_prefix (server->buffer, PREFIX_INFO);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("Received a "));
+ COLOR_WIN_CHAT, "CTCP ");
gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL, _("CTCP VERSION "));
+ COLOR_WIN_CHAT_CHANNEL, "VERSION ");
gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("from"));
+ COLOR_WIN_CHAT, _("received from"));
gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, " %s\n", host);
+ COLOR_WIN_CHAT_NICK, " %s", host);
+ if (pos2)
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, ": %s\n", pos2);
+ else
+ gui_printf (server->buffer, "\n");
return 0;
}
@@ -1373,6 +1389,15 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
host);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "CTCP ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL, "PING ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("received from"));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, " %s\n", host);
return 0;
}
@@ -1632,6 +1657,39 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
return 0;
}
+ /* unknown CTCP ? */
+ pos2 = strchr (pos + 1, '\01');
+ if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0'))
+ {
+ pos++;
+ pos2[0] = '\0';
+ pos2 = strchr (pos, ' ');
+ if (pos2)
+ {
+ pos2[0] = '\0';
+ pos2++;
+ while (pos2[0] == ' ')
+ pos2++;
+ if (!pos2[0])
+ pos2 = NULL;
+ }
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("Unknown CTCP "));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL, "%s ", pos);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("received from"));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, " %s", host);
+ if (pos2)
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, ": %s\n", pos2);
+ else
+ gui_printf (server->buffer, "\n");
+ return 0;
+ }
+
/* private message received => display it */
ptr_channel = channel_search (server, host);
if (!ptr_channel)
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index 7f14b1689..c4214df0a 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
+#include <ctype.h>
#include <sys/time.h>
#include <time.h>
#include <sys/utsname.h>
@@ -329,53 +330,67 @@ irc_cmd_send_ban (t_irc_server *server, char *arguments)
int
irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
{
- char *pos, *pos2;
+ char *pos_type, *pos_args, *pos;
struct timeval tv;
struct timezone tz;
- pos = strchr (arguments, ' ');
- if (pos)
+ pos_type = strchr (arguments, ' ');
+ if (pos_type)
{
- pos[0] = '\0';
- pos++;
- while (pos[0] == ' ')
- pos++;
- pos2 = strchr (pos, ' ');
- if (pos2)
+ pos_type[0] = '\0';
+ pos_type++;
+ while (pos_type[0] == ' ')
+ pos_type++;
+ pos_args = strchr (pos_type, ' ');
+ if (pos_args)
{
- pos2[0] = '\0';
- pos2++;
- while (pos2[0] == ' ')
- pos2++;
+ pos_args[0] = '\0';
+ pos_args++;
+ while (pos_args[0] == ' ')
+ pos_args++;
}
else
- pos2 = NULL;
+ pos_args = NULL;
- if (strcasecmp (pos, "version") == 0)
+ pos = pos_type;
+ while (pos[0])
{
- if (pos2)
- server_sendf (server, "PRIVMSG %s :\01VERSION %s\01\r\n",
- arguments, pos2);
- else
- server_sendf (server, "PRIVMSG %s :\01VERSION\01\r\n",
- arguments);
- }
- if (strcasecmp (pos, "action") == 0)
- {
- if (pos2)
- server_sendf (server, "PRIVMSG %s :\01ACTION %s\01\r\n",
- arguments, pos2);
- else
- server_sendf (server, "PRIVMSG %s :\01ACTION\01\r\n",
- arguments);
+ pos[0] = toupper (pos[0]);
+ pos++;
}
- if (strcasecmp (pos, "ping") == 0)
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "(");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_type);
+
+ if ((strcasecmp (pos_type, "ping") == 0) && (!pos_args))
{
gettimeofday (&tv, &tz);
server_sendf (server, "PRIVMSG %s :\01PING %d %d\01\r\n",
arguments, tv.tv_sec, tv.tv_usec);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, " %d %d\n",
+ tv.tv_sec, tv.tv_usec);
+ }
+ else
+ {
+ if (pos_args)
+ {
+ server_sendf (server, "PRIVMSG %s :\01%s %s\01\r\n",
+ arguments, pos_type, pos_args);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, " %s\n",
+ pos_args);
+ }
+ else
+ {
+ server_sendf (server, "PRIVMSG %s :\01%s\01\r\n",
+ arguments, pos_type);
+ gui_printf (server->buffer, "\n");
+ }
}
-
}
return 0;
}