Add /list

weechat-hashes
C. McEnroe 2020-02-12 02:39:23 -05:00
parent 456713e561
commit 489df70c37
4 changed files with 35 additions and 1 deletions

View File

@ -179,6 +179,8 @@ can be typed
.Bl -tag -width Ds .Bl -tag -width Ds
.It Ic /join Ar channel .It Ic /join Ar channel
Join a channel. Join a channel.
.It Ic /list Op Ar channel
List channels.
.It Ic /me Op Ar action .It Ic /me Op Ar action
Send an action message. Send an action message.
.It Ic /msg Ar nick message .It Ic /msg Ar nick message

3
chat.h
View File

@ -133,8 +133,9 @@ void ircFormat(const char *format, ...)
extern struct Replies { extern struct Replies {
size_t join; size_t join;
size_t topic; size_t list;
size_t names; size_t names;
size_t topic;
size_t whois; size_t whois;
} replies; } replies;

View File

@ -125,6 +125,16 @@ static void commandNames(size_t id, char *params) {
replies.names++; replies.names++;
} }
static void commandList(size_t id, char *params) {
(void)id;
if (params) {
ircFormat("LIST :%s\r\n", params);
} else {
ircFormat("LIST\r\n");
}
replies.list++;
}
static void commandWhois(size_t id, char *params) { static void commandWhois(size_t id, char *params) {
(void)id; (void)id;
if (!params) return; if (!params) return;
@ -201,6 +211,7 @@ static const struct Handler {
{ "/debug", .fn = commandDebug, .restricted = true }, { "/debug", .fn = commandDebug, .restricted = true },
{ "/help", .fn = commandHelp }, { "/help", .fn = commandHelp },
{ "/join", .fn = commandJoin, .restricted = true }, { "/join", .fn = commandJoin, .restricted = true },
{ "/list", .fn = commandList },
{ "/me", .fn = commandMe }, { "/me", .fn = commandMe },
{ "/msg", .fn = commandMsg, .restricted = true }, { "/msg", .fn = commandMsg, .restricted = true },
{ "/names", .fn = commandNames }, { "/names", .fn = commandNames },

View File

@ -411,6 +411,24 @@ static void handleTopic(struct Message *msg) {
} }
} }
static void handleReplyList(struct Message *msg) {
require(msg, false, 4);
if (!replies.list) return;
uiFormat(
Network, Warm, tagTime(msg),
"In \3%02d%s\3 are %ld under the banner: %s",
hash(msg->params[1]), msg->params[1],
strtol(msg->params[2], NULL, 10),
msg->params[3]
);
}
static void handleReplyListEnd(struct Message *msg) {
(void)msg;
if (!replies.list) return;
replies.list--;
}
static void handleReplyWhoisUser(struct Message *msg) { static void handleReplyWhoisUser(struct Message *msg) {
require(msg, false, 6); require(msg, false, 6);
if (!replies.whois) return; if (!replies.whois) return;
@ -657,6 +675,8 @@ static const struct Handler {
{ "317", handleReplyWhoisIdle }, { "317", handleReplyWhoisIdle },
{ "318", handleReplyEndOfWhois }, { "318", handleReplyEndOfWhois },
{ "319", handleReplyWhoisChannels }, { "319", handleReplyWhoisChannels },
{ "322", handleReplyList },
{ "323", handleReplyListEnd },
{ "330", handleReplyWhoisGeneric }, { "330", handleReplyWhoisGeneric },
{ "331", handleReplyNoTopic }, { "331", handleReplyNoTopic },
{ "332", handleReplyTopic }, { "332", handleReplyTopic },