aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-clipboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mds-clipboard.c')
-rw-r--r--src/mds-clipboard.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/mds-clipboard.c b/src/mds-clipboard.c
index bf159ee..a282772 100644
--- a/src/mds-clipboard.c
+++ b/src/mds-clipboard.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -433,7 +433,7 @@ handle_message(void)
int level;
#define __get_header(storage, header)\
- (startswith(received.headers[i], header))\
+ (strstarts(received.headers[i], header))\
storage = received.headers[i] + strlen(header)
for (i = 0; i < received.header_count; i++) {
@@ -456,7 +456,7 @@ handle_message(void)
return eprint("received message without ID, ignoring, master server is misbehaving."), 0;
if (recv_client_closed) {
- if (strequals(recv_client_closed, "0:0"))
+ if (streq(recv_client_closed, "0:0"))
return 0;
return clipboard_death(recv_client_closed);
}
@@ -468,27 +468,27 @@ handle_message(void)
level = atoi(recv_level);
if ((level < 0) || (CLIPBOARD_LEVELS <= level))
return eprint("received message without invalid clipboard level, ignoring."), 0;
- if (strequals(recv_client_id, "0:0"))
- if (strequals(recv_action, "read") || strequals(recv_action, "get-size"))
+ if (streq(recv_client_id, "0:0"))
+ if (streq(recv_action, "read") || streq(recv_action, "get-size"))
return eprint("received information request from an anonymous client, ignoring."), 0;
- if (strequals(recv_action, "add")) {
+ if (streq(recv_action, "add")) {
if (recv_length == NULL)
return eprint("received request for adding a clipboard entry "
"but did not receive any content, ignoring."), 0;
- if ((strequals(recv_client_id, "0:0")) && startswith(recv_time_to_live, "until-death"))
+ if ((streq(recv_client_id, "0:0")) && strstarts(recv_time_to_live, "until-death"))
return eprint("received request new clipboard entry with autopurge upon "
"client close from an anonymous client, ignoring."), 0;
return clipboard_add(level, recv_time_to_live, recv_client_id);
- } else if (strequals(recv_action, "read")) {
+ } else if (streq(recv_action, "read")) {
return clipboard_read(level, atoz(recv_index), recv_client_id, recv_message_id);
- } else if (strequals(recv_action, "clear")) {
+ } else if (streq(recv_action, "clear")) {
return clipboard_clear(level);
- } else if (strequals(recv_action, "set-size")) {
+ } else if (streq(recv_action, "set-size")) {
if (recv_size == NULL)
return eprint("received request for clipboard resizing without a new size, ignoring."), 0;
return clipboard_set_size(level, atoz(recv_size));
- } else if (strequals(recv_action, "get-size")) {
+ } else if (streq(recv_action, "get-size")) {
return clipboard_get_size(level, recv_client_id, recv_message_id);
}
@@ -654,11 +654,11 @@ clipboard_add(int level, const char *time_to_live, const char *recv_client_id)
fail_if (clipboard_purge(level, NULL));
- if (strequals(time_to_live, "forever")) {
+ if (streq(time_to_live, "forever")) {
autopurge = CLIPITEM_AUTOPURGE_NEVER;
- } else if (strequals(time_to_live, "until-death")) {
+ } else if (streq(time_to_live, "until-death")) {
autopurge = CLIPITEM_AUTOPURGE_UPON_DEATH;
- } else if (startswith(time_to_live, "until-death ")) {
+ } else if (strstarts(time_to_live, "until-death ")) {
autopurge = CLIPITEM_AUTOPURGE_UPON_DEATH_OR_CLOCK;
time_to_live += strlen("until-death ");
}