summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--chat.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/chat.c b/chat.c
index 4955b4b..cea0f11 100644
--- a/chat.c
+++ b/chat.c
@@ -126,6 +126,9 @@ static void clientFmt(const char *format, ...) {
 
 typedef void (*Handler)(char *prefix, char *params);
 
+static char *prift(char **prefix) {
+	return strsep(prefix, "!@");
+}
 static char *shift(char **params) {
 	char *rest = *params;
 	if (!rest) errx(EX_PROTOCOL, "expected param");
@@ -147,20 +150,20 @@ static void handlePing(char *prefix, char *params) {
 }
 
 static void handleJoin(char *prefix, char *params) {
-	char *nick = strsep(&prefix, "!");
+	char *nick = prift(&prefix);
 	char *chan = shift(&params);
 	uiFmt("--> %s arrived in %s", nick, chan);
 }
 static void handlePart(char *prefix, char *params) {
-	char *nick = strsep(&prefix, "!");
+	char *nick = prift(&prefix);
 	char *chan = shift(&params);
-	char *reason = shift(&params);
-	uiFmt("<-- %s left %s, \"%s\"", nick, chan, reason);
+	char *mesg = shift(&params);
+	uiFmt("<-- %s left %s, \"%s\"", nick, chan, mesg);
 }
 static void handleQuit(char *prefix, char *params) {
-	char *nick = strsep(&prefix, "!");
-	char *reason = shift(&params);
-	uiFmt("<-- %s left, \"%s\"", nick, reason);
+	char *nick = prift(&prefix);
+	char *mesg = shift(&params);
+	uiFmt("<-- %s left, \"%s\"", nick, mesg);
 }
 
 static void handle332(char *prefix, char *params) {
@@ -168,15 +171,15 @@ static void handle332(char *prefix, char *params) {
 	shift(&params);
 	char *chan = shift(&params);
 	char *topic = shift(&params);
-	uiTopic(topic);
 	uiFmt("--- The sign in %s reads, \"%s\"", chan, topic);
+	uiTopic(topic);
 }
 static void handleTopic(char *prefix, char *params) {
-	char *nick = strsep(&prefix, "!");
+	char *nick = prift(&prefix);
 	char *chan = shift(&params);
 	char *topic = shift(&params);
-	uiTopic(topic);
 	uiFmt("--- %s placed a new sign in %s, \"%s\"", nick, chan, topic);
+	uiTopic(topic);
 }
 
 static void handle353(char *prefix, char *params) {
@@ -190,13 +193,13 @@ static void handle353(char *prefix, char *params) {
 }
 
 static void handlePrivmsg(char *prefix, char *params) {
-	char *nick = strsep(&prefix, "!");
+	char *nick = prift(&prefix);
 	shift(&params);
 	char *message = shift(&params);
 	uiFmt("<%s> %s", nick, message);
 }
 static void handleNotice(char *prefix, char *params) {
-	char *nick = strsep(&prefix, "!");
+	char *nick = prift(&prefix);
 	shift(&params);
 	char *message = shift(&params);
 	uiFmt("-%s- %s", nick, message);
-c option to xxJune McEnroe 2016-09-12Add .bin/xx.cJune McEnroe 2016-09-08Rename colorscheme to lameJune McEnroe 2016-09-04Simplify colors syntax in zsh promptJune McEnroe 2016-08-29Color rubyStringDelimiter as StringJune McEnroe 2016-08-24Highlight rubyDefine as StructureJune McEnroe 2016-08-23Remove scroll bindings from nvim configJune McEnroe 2016-08-17Highlight Search with black foregroundJune McEnroe 2016-08-15Remove gruvboxJune McEnroe 2016-08-04Remove march from SSH configJune McEnroe 2016-08-01Disable tab indicators in iTermJune McEnroe 2016-07-30Color PreProc DarkGreenJune McEnroe 2016-07-29Color Structure and Typedef in grayJune McEnroe 2016-07-27Color comments DarkBlue and LightBlueJune McEnroe 2016-07-27Color macros in yellowJune McEnroe 2016-07-26Colorscheme colors and schemesJune McEnroe 2016-07-26Add ''subtle'' colorschemeJune McEnroe I'm just trying this out. 2016-07-26Add htoprcJune McEnroe 2016-07-24Add may and refactor ssh configJune McEnroe 2016-07-18Disable cursorlineJune McEnroe 2016-07-18Use hard constrast gruvbox darkJune McEnroe 2016-07-15Remove vim configurationJune McEnroe 2016-07-15Add readline to README configurations listJune McEnroe 2016-07-15Add vendor script to READMEJune McEnroe 2016-07-15Pull latest pathogen and gruvboxJune McEnroe