summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-05-16 09:40:02 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-05-16 09:40:02 +0200
commit634d960c8dd92e2983e7f351bbbfb8c28d999e3d (patch)
tree2eb9a76eb1ea3a78d0e95d81cee8d5af5bc424de
parent25d3f6e44a64e1a97c3595eeba35be2e89f5474e (diff)
downloadxK-634d960c8dd92e2983e7f351bbbfb8c28d999e3d.tar.gz
xK-634d960c8dd92e2983e7f351bbbfb8c28d999e3d.tar.xz
xK-634d960c8dd92e2983e7f351bbbfb8c28d999e3d.zip
degesch: unindent some code
-rw-r--r--degesch.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/degesch.c b/degesch.c
index 05b9ff5..bf65326 100644
--- a/degesch.c
+++ b/degesch.c
@@ -5117,21 +5117,18 @@ handle_command_join (struct app_context *ctx, char *arguments)
// TODO: check if the arguments are in the form of
// "channel(,channel)* key(,key)*"
irc_send (s, "JOIN %s", arguments);
+ else if (ctx->current_buffer->type != BUFFER_CHANNEL)
+ buffer_send_error (ctx, ctx->current_buffer,
+ "%s: %s", "Can't join",
+ "no argument given and this buffer is not a channel");
+ // TODO: have a better way of checking if we're on the channel
+ else if (ctx->current_buffer->channel->users)
+ buffer_send_error (ctx, ctx->current_buffer,
+ "%s: %s", "Can't join",
+ "you already are on the channel");
else
- {
- if (ctx->current_buffer->type != BUFFER_CHANNEL)
- buffer_send_error (ctx, ctx->current_buffer,
- "%s: %s", "Can't join",
- "no argument given and this buffer is not a channel");
- // TODO: have a better way of checking if we're on the channel
- else if (ctx->current_buffer->channel->users)
- buffer_send_error (ctx, ctx->current_buffer,
- "%s: %s", "Can't join",
- "you already are on the channel");
- else
- // TODO: send the key if known
- irc_send (s, "JOIN %s", ctx->current_buffer->channel->name);
- }
+ // TODO: send the key if known
+ irc_send (s, "JOIN %s", ctx->current_buffer->channel->name);
return true;
}
@@ -5146,19 +5143,16 @@ handle_command_part (struct app_context *ctx, char *arguments)
// TODO: check if the arguments are in the form of "channel(,channel)*"
// TODO: make sure to send the reason as one argument
irc_send (s, "PART %s", arguments);
+ else if (ctx->current_buffer->type != BUFFER_CHANNEL)
+ buffer_send_error (ctx, ctx->current_buffer,
+ "%s: %s", "Can't part",
+ "no argument given and this buffer is not a channel");
+ // TODO: have a better way of checking if we're on the channel
+ else if (!ctx->current_buffer->channel->users)
+ buffer_send_error (ctx, ctx->current_buffer,
+ "%s: %s", "Can't join", "you're not on the channel");
else
- {
- if (ctx->current_buffer->type != BUFFER_CHANNEL)
- buffer_send_error (ctx, ctx->current_buffer,
- "%s: %s", "Can't part",
- "no argument given and this buffer is not a channel");
- // TODO: have a better way of checking if we're on the channel
- else if (!ctx->current_buffer->channel->users)
- buffer_send_error (ctx, ctx->current_buffer,
- "%s: %s", "Can't join", "you're not on the channel");
- else
- irc_send (s, "PART %s", ctx->current_buffer->channel->name);
- }
+ irc_send (s, "PART %s", ctx->current_buffer->channel->name);
return true;
}