Send a WHO in response to NAMES to get usernames
Other than this slight hack, I think coloring by username rather than nick is a much better idea.master
parent
3b490562d4
commit
c609684d2b
36
chat.c
36
chat.c
|
@ -294,14 +294,38 @@ static void handleTopic(char *prefix, char *params) {
|
||||||
uiTopic(topic);
|
uiTopic(topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle353(char *prefix, char *params) {
|
static void handle366(char *prefix, char *params) {
|
||||||
|
(void)prefix;
|
||||||
|
shift(¶ms);
|
||||||
|
char *chan = shift(¶ms);
|
||||||
|
clientFmt("WHO %s\r\n", chan);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char whoBuf[4096];
|
||||||
|
static size_t whoLen;
|
||||||
|
static void handle352(char *prefix, char *params) {
|
||||||
(void)prefix;
|
(void)prefix;
|
||||||
shift(¶ms);
|
shift(¶ms);
|
||||||
shift(¶ms);
|
shift(¶ms);
|
||||||
|
char *user = shift(¶ms);
|
||||||
|
shift(¶ms);
|
||||||
|
shift(¶ms);
|
||||||
|
char *nick = shift(¶ms);
|
||||||
|
whoLen += snprintf(
|
||||||
|
&whoBuf[whoLen], sizeof(whoBuf) - whoLen,
|
||||||
|
"%s\3%d%s\3",
|
||||||
|
(whoLen ? ", " : ""), color(user), nick
|
||||||
|
);
|
||||||
|
}
|
||||||
|
static void handle315(char *prefix, char *params) {
|
||||||
|
(void)prefix;
|
||||||
|
shift(¶ms);
|
||||||
char *chan = shift(¶ms);
|
char *chan = shift(¶ms);
|
||||||
char *names = shift(¶ms);
|
whoLen = 0;
|
||||||
// TODO: Do a WHO instead to get usernames
|
uiFmt(
|
||||||
uiFmt("In %s are %s", chan, names);
|
"In \3%d%s\3 are %s",
|
||||||
|
color(chan), chan, whoBuf
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handlePrivmsg(char *prefix, char *params) {
|
static void handlePrivmsg(char *prefix, char *params) {
|
||||||
|
@ -324,8 +348,10 @@ static const struct {
|
||||||
Handler handler;
|
Handler handler;
|
||||||
} HANDLERS[] = {
|
} HANDLERS[] = {
|
||||||
{ "001", handle001 },
|
{ "001", handle001 },
|
||||||
|
{ "315", handle315 },
|
||||||
{ "332", handle332 },
|
{ "332", handle332 },
|
||||||
{ "353", handle353 },
|
{ "352", handle352 },
|
||||||
|
{ "366", handle366 },
|
||||||
{ "JOIN", handleJoin },
|
{ "JOIN", handleJoin },
|
||||||
{ "NOTICE", handleNotice },
|
{ "NOTICE", handleNotice },
|
||||||
{ "PART", handlePart },
|
{ "PART", handlePart },
|
||||||
|
|
Loading…
Reference in New Issue