Clean up input parameter handling
parent
fdbc6f2fda
commit
fe38982b43
28
input.c
28
input.c
|
@ -56,11 +56,11 @@ static void inputMe(struct Tag tag, char *params) {
|
||||||
|
|
||||||
static void inputNick(struct Tag tag, char *params) {
|
static void inputNick(struct Tag tag, char *params) {
|
||||||
char *nick = strsep(¶ms, " ");
|
char *nick = strsep(¶ms, " ");
|
||||||
if (nick) {
|
if (!nick) {
|
||||||
ircFmt("NICK :%s\r\n", nick);
|
uiLog(tag, UIHot, L"/nick requires a name");
|
||||||
} else {
|
return;
|
||||||
uiLog(tag, UIHot, L"/nick requires a nickname");
|
|
||||||
}
|
}
|
||||||
|
ircFmt("NICK %s\r\n", nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void inputPart(struct Tag tag, char *params) {
|
static void inputPart(struct Tag tag, char *params) {
|
||||||
|
@ -69,13 +69,13 @@ static void inputPart(struct Tag tag, char *params) {
|
||||||
|
|
||||||
static void inputQuery(struct Tag tag, char *params) {
|
static void inputQuery(struct Tag tag, char *params) {
|
||||||
char *nick = strsep(¶ms, " ");
|
char *nick = strsep(¶ms, " ");
|
||||||
if (nick) {
|
if (!nick) {
|
||||||
|
uiLog(tag, UIHot, L"/query requires a nick");
|
||||||
|
return;
|
||||||
|
}
|
||||||
tabTouch(TagNone, nick);
|
tabTouch(TagNone, nick);
|
||||||
uiShowTag(tagFor(nick));
|
uiShowTag(tagFor(nick));
|
||||||
logReplay(tagFor(nick));
|
logReplay(tagFor(nick));
|
||||||
} else {
|
|
||||||
uiLog(tag, UIHot, L"/query requires a nickname");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void inputQuit(struct Tag tag, char *params) {
|
static void inputQuit(struct Tag tag, char *params) {
|
||||||
|
@ -103,11 +103,11 @@ static void inputWho(struct Tag tag, char *params) {
|
||||||
|
|
||||||
static void inputWhois(struct Tag tag, char *params) {
|
static void inputWhois(struct Tag tag, char *params) {
|
||||||
char *nick = strsep(¶ms, " ");
|
char *nick = strsep(¶ms, " ");
|
||||||
if (nick) {
|
if (!nick) {
|
||||||
ircFmt("WHOIS :%s\r\n", nick);
|
|
||||||
} else {
|
|
||||||
uiLog(tag, UIHot, L"/whois requires a nick");
|
uiLog(tag, UIHot, L"/whois requires a nick");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
ircFmt("WHOIS %s\r\n", nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void inputZNC(struct Tag tag, char *params) {
|
static void inputZNC(struct Tag tag, char *params) {
|
||||||
|
@ -129,11 +129,11 @@ static void inputMan(struct Tag tag, char *params) {
|
||||||
|
|
||||||
static void inputMove(struct Tag tag, char *params) {
|
static void inputMove(struct Tag tag, char *params) {
|
||||||
char *num = strsep(¶ms, " ");
|
char *num = strsep(¶ms, " ");
|
||||||
if (num) {
|
if (!num) {
|
||||||
uiMoveTag(tag, strtol(num, NULL, 0), num[0] == '+' || num[0] == '-');
|
|
||||||
} else {
|
|
||||||
uiLog(tag, UIHot, L"/move requires a number");
|
uiLog(tag, UIHot, L"/move requires a number");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
uiMoveTag(tag, strtol(num, NULL, 0), num[0] == '+' || num[0] == '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void inputOpen(struct Tag tag, char *params) {
|
static void inputOpen(struct Tag tag, char *params) {
|
||||||
|
|
Loading…
Reference in New Issue