summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@irssi.org>2010-04-03 20:09:37 +0000
committerahf <ahf@dbcabf3a-b0e7-0310-adc4-f8d773084564>2010-04-03 20:09:37 +0000
commit8728207191dc544aa473c322fbb779a032aa6d62 (patch)
treefad0fb7b66746551a9593d686fe4c43f76422b7f
parentdf1d7a78147805119f045036fc87c23e2c5c8094 (diff)
downloadirssi-8728207191dc544aa473c322fbb779a032aa6d62.zip
deprecated glib strup/down fixes from exg.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5138 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/core/commands.c4
-rw-r--r--src/core/misc.c18
-rw-r--r--src/core/misc.h3
-rw-r--r--src/fe-common/core/completion.c2
-rw-r--r--src/fe-common/irc/dcc/fe-dcc-chat.c2
-rw-r--r--src/fe-common/irc/fe-irc-commands.c2
-rw-r--r--src/fe-text/statusbar-config.c2
-rw-r--r--src/irc/core/ctcp.c4
-rw-r--r--src/irc/core/irc-commands.c4
-rw-r--r--src/irc/core/irc.c2
-rw-r--r--src/irc/dcc/dcc-chat.c4
-rw-r--r--src/irc/dcc/dcc.c6
-rw-r--r--src/irc/proxy/listen.c4
13 files changed, 39 insertions, 18 deletions
diff --git a/src/core/commands.c b/src/core/commands.c
index f1c86fc7..1b811bc4 100644
--- a/src/core/commands.c
+++ b/src/core/commands.c
@@ -325,7 +325,7 @@ void command_runsub(const char *cmd, const char *data,
subcmd = g_strconcat("command ", newcmd, NULL);
- g_strdown(subcmd);
+ ascii_strdown(subcmd);
if (!signal_emit(subcmd, 3, args, server, item)) {
defcmd = g_strdup_printf("default command %s", cmd);
if (!signal_emit(defcmd, 3, data, server, item)) {
@@ -891,7 +891,7 @@ static void parse_command(const char *command, int expand_aliases,
}
cmd = g_strconcat("command ", newcmd, NULL);
- g_strdown(cmd);
+ ascii_strdown(cmd);
oldcmd = current_command;
current_command = cmd+8;
diff --git a/src/core/misc.c b/src/core/misc.c
index e0df07e5..986e10f3 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -943,3 +943,21 @@ int parse_size(const char *size, int *bytes)
return TRUE;
}
+
+char *ascii_strup(char *str)
+{
+ char *s;
+
+ for (s = str; *s; s++)
+ *s = g_ascii_toupper (*s);
+ return str;
+}
+
+char *ascii_strdown(char *str)
+{
+ char *s;
+
+ for (s = str; *s; s++)
+ *s = g_ascii_tolower (*s);
+ return str;
+}
diff --git a/src/core/misc.h b/src/core/misc.h
index 72a48e5f..2cb8e66a 100644
--- a/src/core/misc.h
+++ b/src/core/misc.h
@@ -92,6 +92,9 @@ char *stristr(const char *data, const char *key);
char *strstr_full(const char *data, const char *key);
char *stristr_full(const char *data, const char *key);
+char *ascii_strup(char *str);
+char *ascii_strdown(char *str);
+
/* Escape all '"', "'" and '\' chars with '\' */
char *escape_string(const char *str);
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index a1241c61..91115e61 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -533,7 +533,7 @@ static char *line_get_command(const char *line, char **args, int aliases)
} while (ptr != NULL);
if (cmd != NULL)
- g_strdown(cmd);
+ ascii_strdown(cmd);
return cmd;
}
diff --git a/src/fe-common/irc/dcc/fe-dcc-chat.c b/src/fe-common/irc/dcc/fe-dcc-chat.c
index f8c2d8c3..c47ad4c4 100644
--- a/src/fe-common/irc/dcc/fe-dcc-chat.c
+++ b/src/fe-common/irc/dcc/fe-dcc-chat.c
@@ -330,7 +330,7 @@ static void cmd_ctcp(const char *data, SERVER_REC *server)
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
IRCTXT_DCC_CHAT_NOT_FOUND, target+1);
} else {
- g_strup(ctcpcmd);
+ ascii_strup(ctcpcmd);
signal_emit("message dcc own_ctcp", 3, dcc, ctcpcmd, ctcpdata);
}
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c
index 79b28746..f2b00590 100644
--- a/src/fe-common/irc/fe-irc-commands.c
+++ b/src/fe-common/irc/fe-irc-commands.c
@@ -131,7 +131,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server,
return;
}
- g_strup(ctcpcmd);
+ ascii_strup(ctcpcmd);
signal_emit("message irc own_ctcp", 4,
server, ctcpcmd, ctcpdata, target);
diff --git a/src/fe-text/statusbar-config.c b/src/fe-text/statusbar-config.c
index 491881d8..53f2dfd0 100644
--- a/src/fe-text/statusbar-config.c
+++ b/src/fe-text/statusbar-config.c
@@ -550,7 +550,7 @@ static void cmd_statusbar(const char *data)
/* call the subcommand */
signal = g_strconcat("command statusbar ", cmd, NULL);
- g_strdown(signal);
+ ascii_strdown(signal);
if (!signal_emit(signal, 4, params, NULL, NULL, node)) {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_STATUSBAR_UNKNOWN_COMMAND, cmd);
diff --git a/src/irc/core/ctcp.c b/src/irc/core/ctcp.c
index 06fad103..be2edba0 100644
--- a/src/irc/core/ctcp.c
+++ b/src/irc/core/ctcp.c
@@ -238,7 +238,7 @@ static void ctcp_msg(IRC_SERVER_REC *server, const char *data,
args = strchr(str+9, ' ');
if (args != NULL) *args++ = '\0'; else args = "";
- g_strdown(str+9);
+ ascii_strdown(str+9);
if (!signal_emit(str, 5, server, args, nick, addr, target)) {
signal_emit("default ctcp msg", 5,
server, data, nick, addr, target);
@@ -258,7 +258,7 @@ static void ctcp_reply(IRC_SERVER_REC *server, const char *data,
args = strchr(str+11, ' ');
if (args != NULL) *args++ = '\0'; else args = "";
- g_strdown(str+11);
+ ascii_strdown(str+11);
if (!signal_emit(str, 5, server, args, nick, addr, target)) {
signal_emit("default ctcp reply", 5,
server, data, nick, addr, target);
diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c
index 8ee5c9bd..52a9a748 100644
--- a/src/irc/core/irc-commands.c
+++ b/src/irc/core/irc-commands.c
@@ -104,7 +104,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server,
if (*target == '\0' || *ctcpcmd == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
- g_strup(ctcpcmd);
+ ascii_strup(ctcpcmd);
if (*ctcpdata == '\0')
g_string_printf(tmpstr, "PRIVMSG %s :\001%s\001", target, ctcpcmd);
else {
@@ -138,7 +138,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server,
if (*target == '\0' || *ctcpcmd == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
- g_strup(ctcpcmd);
+ ascii_strup(ctcpcmd);
recoded = recode_out(SERVER(server), ctcpdata, target);
g_string_printf(tmpstr, "NOTICE %s :\001%s %s\001", target, ctcpcmd, recoded);
g_free(recoded);
diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c
index 1ffecb0b..509418b7 100644
--- a/src/irc/core/irc.c
+++ b/src/irc/core/irc.c
@@ -290,7 +290,7 @@ static void irc_server_event(IRC_SERVER_REC *server, const char *line,
args = strchr(event+6, ' ');
if (args != NULL) *args++ = '\0'; else args = "";
while (*args == ' ') args++;
- g_strdown(event);
+ ascii_strdown(event);
/* check if event needs to be redirected */
signal = server_redirect_get_signal(server, nick, event, args);
diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c
index 61b69d73..b3950002 100644
--- a/src/irc/dcc/dcc-chat.c
+++ b/src/irc/dcc/dcc-chat.c
@@ -281,7 +281,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server)
dcc = dcc_chat_find_id(target+1);
if (dcc != NULL) {
- g_strup(ctcpcmd);
+ ascii_strup(ctcpcmd);
str = g_strconcat(ctcpcmd, " ", ctcpdata, NULL);
dcc_ctcp_message(server, dcc->nick, dcc, FALSE, str);
@@ -719,7 +719,7 @@ static void dcc_chat_msg(CHAT_DCC_REC *dcc, const char *msg)
cmd = g_ascii_strup(cmd, -1);
- g_strdown(event+9);
+ ascii_strdown(event+9);
if (!signal_emit(event, 2, dcc, ptr)) {
signal_emit(reply ? "default dcc reply" :
"default dcc ctcp", 3, dcc, cmd, ptr);
diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c
index bc8d8452..a4bb774e 100644
--- a/src/irc/dcc/dcc.c
+++ b/src/irc/dcc/dcc.c
@@ -367,7 +367,7 @@ static void ctcp_msg_dcc(IRC_SERVER_REC *server, const char *data,
args = strchr(str+13, ' ');
if (args != NULL) *args++ = '\0'; else args = "";
- g_strdown(str+13);
+ ascii_strdown(str+13);
if (!signal_emit(str, 6, server, args, nick, addr, target, chat)) {
signal_emit("default ctcp msg dcc", 6,
server, data, nick, addr, target, chat);
@@ -389,7 +389,7 @@ static void ctcp_reply_dcc(IRC_SERVER_REC *server, const char *data,
args = strchr(str+15, ' ');
if (args != NULL) *args++ = '\0'; else args = "";
- g_strdown(str+15);
+ ascii_strdown(str+15);
if (!signal_emit(str, 5, server, args, nick, addr, target)) {
signal_emit("default ctcp reply dcc", 5,
server, data, nick, addr, target);
@@ -502,7 +502,7 @@ static void cmd_dcc_close(char *data, IRC_SERVER_REC *server)
if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
- g_strup(typestr);
+ ascii_strup(typestr);
type = dcc_str2type(typestr);
if (type == -1) {
signal_emit("dcc error unknown type", 1, typestr);
diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c
index 57318642..4df315fd 100644
--- a/src/irc/proxy/listen.c
+++ b/src/irc/proxy/listen.c
@@ -317,7 +317,7 @@ static void sig_listen_client(CLIENT_REC *client)
args = strchr(cmd, ' ');
if (args != NULL) *args++ = '\0'; else args = "";
if (*args == ':') args++;
- g_strup(cmd);
+ ascii_strup(cmd);
handle_client_cmd(client, cmd, args, str);
@@ -391,7 +391,7 @@ static void sig_server_event(IRC_SERVER_REC *server, const char *line,
args = strchr(event+6, ' ');
if (args != NULL) *args++ = '\0'; else args = "";
while (*args == ' ') args++;
- g_strdown(event);
+ ascii_strdown(event);
signal = server_redirect_peek_signal(server, nick, event, args, &redirected);
if ((signal != NULL && strncmp(signal, "proxy ", 6) != 0) ||