about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2018-09-27 17:27:37 +0200
committerGitHub <noreply@github.com>2018-09-27 17:27:37 +0200
commit47f90d7a39002ce4ee683179e25797a78cf95905 (patch)
treed3ab27090ef03ed6c88a414293eb97e8e54a03f0 /src/ui
parentbb87122af9f477f8f0b53240537aae20c105a88c (diff)
parent2e0bc27bf0d19f07fa60a48dfd8189edb4462f54 (diff)
downloadprofani-tty-47f90d7a39002ce4ee683179e25797a78cf95905.tar.gz
Merge pull request #991 from paulfariello/feature/xep-0050
Add support for xep 0050 ad-hoc commands, without multi-step
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/confwin.c (renamed from src/ui/mucconfwin.c)32
-rw-r--r--src/ui/console.c10
-rw-r--r--src/ui/core.c20
-rw-r--r--src/ui/statusbar.c2
-rw-r--r--src/ui/ui.h21
-rw-r--r--src/ui/win_types.h12
-rw-r--r--src/ui/window.c94
-rw-r--r--src/ui/window_list.c18
-rw-r--r--src/ui/window_list.h6
9 files changed, 144 insertions, 71 deletions
diff --git a/src/ui/mucconfwin.c b/src/ui/confwin.c
index 7a658a1e..9791e5cf 100644
--- a/src/ui/mucconfwin.c
+++ b/src/ui/confwin.c
@@ -1,5 +1,5 @@
 /*
- * mucconfwin.c
+ * confwin.c
  *
  * Copyright (C) 2012 - 2018 James Booth <boothj5@gmail.com>
  *
@@ -40,10 +40,10 @@
 #include "ui/win_types.h"
 #include "ui/window_list.h"
 
-static void _mucconfwin_form_field(ProfWin *window, char *tag, FormField *field);
+static void _confwin_form_field(ProfWin *window, char *tag, FormField *field);
 
 void
-mucconfwin_show_form(ProfMucConfWin *confwin)
+confwin_show_form(ProfConfWin *confwin)
 {
     ProfWin *window = (ProfWin*) confwin;
     if (confwin->form->title) {
@@ -54,7 +54,7 @@ mucconfwin_show_form(ProfMucConfWin *confwin)
     }
     win_println(window, THEME_DEFAULT, '-', "");
 
-    mucconfwin_form_help(confwin);
+    confwin_form_help(confwin);
 
     GSList *fields = confwin->form->fields;
     GSList *curr_field = fields;
@@ -68,7 +68,7 @@ mucconfwin_show_form(ProfMucConfWin *confwin)
             }
         } else if (g_strcmp0(field->type, "hidden") != 0 && field->var) {
             char *tag = g_hash_table_lookup(confwin->form->var_to_tag, field->var);
-            _mucconfwin_form_field(window, tag, field);
+            _confwin_form_field(window, tag, field);
         }
 
         curr_field = g_slist_next(curr_field);
@@ -76,35 +76,37 @@ mucconfwin_show_form(ProfMucConfWin *confwin)
 }
 
 void
-mucconfwin_show_form_field(ProfMucConfWin *confwin, DataForm *form, char *tag)
+confwin_show_form_field(ProfConfWin *confwin, DataForm *form, char *tag)
 {
     assert(confwin != NULL);
 
     FormField *field = form_get_field_by_tag(form, tag);
     ProfWin *window = (ProfWin*)confwin;
-    _mucconfwin_form_field(window, tag, field);
+    _confwin_form_field(window, tag, field);
     win_println(window, THEME_DEFAULT, '-', "");
 }
 
 void
-mucconfwin_handle_configuration(ProfMucConfWin *confwin, DataForm *form)
+confwin_handle_configuration(ProfConfWin *confwin, DataForm *form)
 {
     assert(confwin != NULL);
 
     ProfWin *window = (ProfWin*)confwin;
     ui_focus_win(window);
 
-    mucconfwin_show_form(confwin);
+    confwin_show_form(confwin);
 
     win_println(window, THEME_DEFAULT, '-', "");
-    win_println(window, THEME_DEFAULT, '-', "Use '/form submit' to save changes.");
+    if (confwin->submit != NULL) {
+        win_println(window, THEME_DEFAULT, '-', "Use '/form submit' to save changes.");
+    }
     win_println(window, THEME_DEFAULT, '-', "Use '/form cancel' to cancel changes.");
     win_println(window, THEME_DEFAULT, '-', "See '/form help' for more information.");
     win_println(window, THEME_DEFAULT, '-', "");
 }
 
 void
-mucconfwin_field_help(ProfMucConfWin *confwin, char *tag)
+confwin_field_help(ProfConfWin *confwin, char *tag)
 {
     assert(confwin != NULL);
 
@@ -187,7 +189,7 @@ mucconfwin_field_help(ProfMucConfWin *confwin, char *tag)
 }
 
 void
-mucconfwin_form_help(ProfMucConfWin *confwin)
+confwin_form_help(ProfConfWin *confwin)
 {
     assert(confwin != NULL);
 
@@ -200,7 +202,7 @@ mucconfwin_form_help(ProfMucConfWin *confwin)
 }
 
 static void
-_mucconfwin_form_field(ProfWin *window, char *tag, FormField *field)
+_confwin_form_field(ProfWin *window, char *tag, FormField *field)
 {
     win_print(window, THEME_AWAY, '-', "[%s] ", tag);
     win_append(window, THEME_DEFAULT, "%s", field->label);
@@ -258,7 +260,7 @@ _mucconfwin_form_field(ProfWin *window, char *tag, FormField *field)
             if (value == NULL) {
                 win_appendln(window, THEME_OFFLINE, "FALSE");
             } else {
-                if (g_strcmp0(value, "0") == 0) {
+                if (g_strcmp0(value, "0") == 0 || g_strcmp0(value, "false") == 0) {
                     win_appendln(window, THEME_OFFLINE, "FALSE");
                 } else {
                     win_appendln(window, THEME_ONLINE, "TRUE");
@@ -331,7 +333,7 @@ _mucconfwin_form_field(ProfWin *window, char *tag, FormField *field)
 }
 
 char*
-mucconfwin_get_string(ProfMucConfWin *confwin)
+confwin_get_string(ProfConfWin *confwin)
 {
     assert(confwin != NULL);
 
diff --git a/src/ui/console.c b/src/ui/console.c
index 9bead705..f5c0379b 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -1282,12 +1282,12 @@ cons_time_setting(void)
         cons_show("Time MUC (/time)                    : %s", pref_time_muc);
     prefs_free_string(pref_time_muc);
 
-    char *pref_time_mucconf = prefs_get_string(PREF_TIME_MUCCONFIG);
-    if (g_strcmp0(pref_time_mucconf, "off") == 0)
-        cons_show("Time MUC config (/time)             : OFF");
+    char *pref_time_conf = prefs_get_string(PREF_TIME_CONFIG);
+    if (g_strcmp0(pref_time_conf, "off") == 0)
+        cons_show("Time config (/time)             : OFF");
     else
-        cons_show("Time MUC config (/time)             : %s", pref_time_mucconf);
-    prefs_free_string(pref_time_mucconf);
+        cons_show("Time config (/time)             : %s", pref_time_conf);
+    prefs_free_string(pref_time_conf);
 
     char *pref_time_private = prefs_get_string(PREF_TIME_PRIVATE);
     if (g_strcmp0(pref_time_private, "off") == 0)
diff --git a/src/ui/core.c b/src/ui/core.c
index 5246d06a..da4e6469 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -632,8 +632,8 @@ ui_win_has_unsaved_form(int num)
 {
     ProfWin *window = wins_get_by_num(num);
 
-    if (window->type == WIN_MUC_CONFIG) {
-        ProfMucConfWin *confwin = (ProfMucConfWin*)window;
+    if (window->type == WIN_CONFIG) {
+        ProfConfWin *confwin = (ProfConfWin*)window;
         assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
         return confwin->form->modified;
     } else {
@@ -651,13 +651,13 @@ ui_focus_win(ProfWin *window)
     }
 
     ProfWin *old_current = wins_get_current();
-    if (old_current->type == WIN_MUC_CONFIG) {
-        ProfMucConfWin *confwin = (ProfMucConfWin*)old_current;
+    if (old_current->type == WIN_CONFIG) {
+        ProfConfWin *confwin = (ProfConfWin*)old_current;
         cmd_ac_remove_form_fields(confwin->form);
     }
 
-    if (window->type == WIN_MUC_CONFIG) {
-        ProfMucConfWin *confwin = (ProfMucConfWin*)window;
+    if (window->type == WIN_CONFIG) {
+        ProfConfWin *confwin = (ProfConfWin*)window;
         cmd_ac_add_form_fields(confwin->form);
     }
 
@@ -681,8 +681,8 @@ void
 ui_close_win(int index)
 {
     ProfWin *window = wins_get_by_num(index);
-    if (window && window->type == WIN_MUC_CONFIG) {
-        ProfMucConfWin *confwin = (ProfMucConfWin*)window;
+    if (window && window->type == WIN_CONFIG) {
+        ProfConfWin *confwin = (ProfConfWin*)window;
         if (confwin->form) {
             cmd_ac_remove_form_fields(confwin->form);
         }
@@ -1135,7 +1135,7 @@ ui_handle_room_config_submit_result(const char *const roomjid)
 
         GString *form_recipient = g_string_new(roomjid);
         g_string_append(form_recipient, " config");
-        form_window = (ProfWin*) wins_get_muc_conf(form_recipient->str);
+        form_window = (ProfWin*) wins_get_conf(form_recipient->str);
         g_string_free(form_recipient, TRUE);
 
         if (form_window) {
@@ -1167,7 +1167,7 @@ ui_handle_room_config_submit_result_error(const char *const roomjid, const char
 
         GString *form_recipient = g_string_new(roomjid);
         g_string_append(form_recipient, " config");
-        form_window = (ProfWin*) wins_get_muc_conf(form_recipient->str);
+        form_window = (ProfWin*) wins_get_conf(form_recipient->str);
         g_string_free(form_recipient, TRUE);
 
         if (form_window) {
diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c
index ac1d7498..5d860440 100644
--- a/src/ui/statusbar.c
+++ b/src/ui/statusbar.c
@@ -544,7 +544,7 @@ _display_name(StatusBarTab *tab)
         } else {
             fullname = strdup(tab->identifier);
         }
-    } else if (tab->window_type == WIN_MUC_CONFIG) {
+    } else if (tab->window_type == WIN_CONFIG) {
         char *pref = prefs_get_string(PREF_STATUSBAR_ROOM);
         GString *display_str = g_string_new("");
         if (g_strcmp0("room", pref) == 0) {
diff --git a/src/ui/ui.h b/src/ui/ui.h
index d344f855..f608483d 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -217,13 +217,13 @@ void privwin_room_kicked(ProfPrivateWin *privwin, const char *const actor, const
 void privwin_room_banned(ProfPrivateWin *privwin, const char *const actor, const char *const reason);
 void privwin_room_joined(ProfPrivateWin *privwin);
 
-// MUC room config window
-void mucconfwin_handle_configuration(ProfMucConfWin *confwin, DataForm *form);
-void mucconfwin_show_form(ProfMucConfWin *confwin);
-void mucconfwin_show_form_field(ProfMucConfWin *confwin, DataForm *form, char *tag);
-void mucconfwin_form_help(ProfMucConfWin *confwin);
-void mucconfwin_field_help(ProfMucConfWin *confwin, char *tag);
-char* mucconfwin_get_string(ProfMucConfWin *confwin);
+// config window
+void confwin_handle_configuration(ProfConfWin *confwin, DataForm *form);
+void confwin_show_form(ProfConfWin *confwin);
+void confwin_show_form_field(ProfConfWin *confwin, DataForm *form, char *tag);
+void confwin_form_help(ProfConfWin *confwin);
+void confwin_field_help(ProfConfWin *confwin, char *tag);
+char* confwin_get_string(ProfConfWin *confwin);
 
 // xml console
 void xmlwin_show(ProfXMLWin *xmlwin, const char *const msg);
@@ -346,7 +346,7 @@ ProfWin* win_create_console(void);
 ProfWin* win_create_xmlconsole(void);
 ProfWin* win_create_chat(const char *const barejid);
 ProfWin* win_create_muc(const char *const roomjid);
-ProfWin* win_create_muc_config(const char *const title, DataForm *form);
+ProfWin* win_create_config(const char *const title, DataForm *form, ProfConfWinCallback submit, ProfConfWinCallback cancel, const void *userdata);
 ProfWin* win_create_private(const char *const fulljid);
 ProfWin* win_create_plugin(const char *const plugin_name, const char *const tag);
 void win_update_virtual(ProfWin *window);
@@ -377,6 +377,11 @@ void win_show_info(ProfWin *window, PContact contact);
 void win_clear(ProfWin *window);
 char* win_get_tab_identifier(ProfWin *window);
 char* win_to_string(ProfWin *window);
+void win_command_list_error(ProfWin *window, const char *const error);
+void win_command_exec_error(ProfWin *window, const char *const command, const char *const error, ...);
+void win_handle_command_list(ProfWin *window, GSList *cmds);
+void win_handle_command_exec_status(ProfWin *window, const char *const type, const char *const value);
+void win_handle_command_exec_result_note(ProfWin *window, const char *const type, const char *const value);
 
 // desktop notifications
 void notifier_initialise(void);
diff --git a/src/ui/win_types.h b/src/ui/win_types.h
index 7fa75b34..eb453cd0 100644
--- a/src/ui/win_types.h
+++ b/src/ui/win_types.h
@@ -128,7 +128,7 @@ typedef enum {
     WIN_CONSOLE,
     WIN_CHAT,
     WIN_MUC,
-    WIN_MUC_CONFIG,
+    WIN_CONFIG,
     WIN_PRIVATE,
     WIN_XML,
     WIN_PLUGIN
@@ -172,12 +172,18 @@ typedef struct prof_muc_win_t {
     char *message_char;
 } ProfMucWin;
 
-typedef struct prof_mucconf_win_t {
+typedef struct prof_conf_win_t ProfConfWin;
+typedef void (*ProfConfWinCallback)(ProfConfWin *);
+
+struct prof_conf_win_t {
     ProfWin window;
     char *roomjid;
     DataForm *form;
     unsigned long memcheck;
-} ProfMucConfWin;
+    ProfConfWinCallback submit;
+    ProfConfWinCallback cancel;
+    const void *userdata;
+};
 
 typedef struct prof_private_win_t {
     ProfWin window;
diff --git a/src/ui/window.c b/src/ui/window.c
index 5543707d..be89d295 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -203,13 +203,16 @@ win_create_muc(const char *const roomjid)
 }
 
 ProfWin*
-win_create_muc_config(const char *const roomjid, DataForm *form)
+win_create_config(const char *const roomjid, DataForm *form, ProfConfWinCallback submit, ProfConfWinCallback cancel, const void *userdata)
 {
-    ProfMucConfWin *new_win = malloc(sizeof(ProfMucConfWin));
-    new_win->window.type = WIN_MUC_CONFIG;
+    ProfConfWin *new_win = malloc(sizeof(ProfConfWin));
+    new_win->window.type = WIN_CONFIG;
     new_win->window.layout = _win_create_simple_layout();
     new_win->roomjid = strdup(roomjid);
     new_win->form = form;
+    new_win->submit = submit;
+    new_win->cancel = cancel;
+    new_win->userdata = userdata;
 
     new_win->memcheck = PROFCONFWIN_MEMCHECK;
 
@@ -289,8 +292,8 @@ win_get_title(ProfWin *window)
         assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
         return strdup(mucwin->roomjid);
     }
-    if (window->type == WIN_MUC_CONFIG) {
-        ProfMucConfWin *confwin = (ProfMucConfWin*) window;
+    if (window->type == WIN_CONFIG) {
+        ProfConfWin *confwin = (ProfConfWin*) window;
         assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
         GString *title = g_string_new(confwin->roomjid);
         g_string_append(title, " config");
@@ -338,10 +341,10 @@ win_get_tab_identifier(ProfWin *window)
             ProfMucWin *mucwin = (ProfMucWin*)window;
             return strdup(mucwin->roomjid);
         }
-        case WIN_MUC_CONFIG:
+        case WIN_CONFIG:
         {
-            ProfMucConfWin *mucconfwin = (ProfMucConfWin*)window;
-            return strdup(mucconfwin->roomjid);
+            ProfConfWin *confwin = (ProfConfWin*)window;
+            return strdup(confwin->roomjid);
         }
         case WIN_PRIVATE:
         {
@@ -383,10 +386,10 @@ win_to_string(ProfWin *window)
             ProfMucWin *mucwin = (ProfMucWin*)window;
             return mucwin_get_string(mucwin);
         }
-        case WIN_MUC_CONFIG:
+        case WIN_CONFIG:
         {
-            ProfMucConfWin *mucconfwin = (ProfMucConfWin*)window;
-            return mucconfwin_get_string(mucconfwin);
+            ProfConfWin *confwin = (ProfConfWin*)window;
+            return confwin_get_string(confwin);
         }
         case WIN_PRIVATE:
         {
@@ -491,11 +494,11 @@ win_free(ProfWin* window)
         free(mucwin->message_char);
         break;
     }
-    case WIN_MUC_CONFIG:
+    case WIN_CONFIG:
     {
-        ProfMucConfWin *mucconf = (ProfMucConfWin*)window;
-        free(mucconf->roomjid);
-        form_destroy(mucconf->form);
+        ProfConfWin *conf = (ProfConfWin*)window;
+        free(conf->roomjid);
+        form_destroy(conf->form);
         break;
     }
     case WIN_PRIVATE:
@@ -1389,8 +1392,8 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
         case WIN_MUC:
             time_pref = prefs_get_string(PREF_TIME_MUC);
             break;
-        case WIN_MUC_CONFIG:
-            time_pref = prefs_get_string(PREF_TIME_MUCCONFIG);
+        case WIN_CONFIG:
+            time_pref = prefs_get_string(PREF_TIME_CONFIG);
             break;
         case WIN_PRIVATE:
             time_pref = prefs_get_string(PREF_TIME_PRIVATE);
@@ -1724,3 +1727,60 @@ win_sub_newline_lazy(WINDOW *win)
         wmove(win, cury+1, 0);
     }
 }
+
+void
+win_command_list_error(ProfWin *window, const char *const error)
+{
+    assert(window != NULL);
+
+    win_println(window, THEME_ERROR, '!', "Error retrieving command list: %s", error);
+}
+
+void
+win_command_exec_error(ProfWin *window, const char *const command, const char *const error, ...)
+{
+    assert(window != NULL);
+    va_list arg;
+    va_start(arg, error);
+    GString *msg = g_string_new(NULL);
+    g_string_vprintf(msg, error, arg);
+
+    win_println(window, THEME_ERROR, '!', "Error executing command %s: %s", command, msg->str);
+
+    g_string_free(msg, TRUE);
+    va_end(arg);
+}
+
+void
+win_handle_command_list(ProfWin *window, GSList *cmds)
+{
+    assert(window != NULL);
+
+    if (cmds) {
+        win_println(window, THEME_DEFAULT, '!', "Ad hoc commands:");
+        GSList *curr_cmd = cmds;
+        while (curr_cmd) {
+            const char *cmd = curr_cmd->data;
+            win_println(window, THEME_DEFAULT, '!', "  %s", cmd);
+            curr_cmd = g_slist_next(curr_cmd);
+        }
+        win_println(window, THEME_DEFAULT, '!', "");
+    } else {
+        win_println(window, THEME_DEFAULT, '!', "No commands found");
+        win_println(window, THEME_DEFAULT, '!', "");
+    }
+}
+
+void
+win_handle_command_exec_status(ProfWin *window, const char *const command, const char *const value)
+{
+    assert(window != NULL);
+    win_println(window, THEME_DEFAULT, '!', "%s %s", command, value);
+}
+
+void
+win_handle_command_exec_result_note(ProfWin *window, const char *const type, const char *const value)
+{
+    assert(window != NULL);
+    win_println(window, THEME_DEFAULT, '!', value);
+}
diff --git a/src/ui/window_list.c b/src/ui/window_list.c
index 798f4e41..a12dc7cb 100644
--- a/src/ui/window_list.c
+++ b/src/ui/window_list.c
@@ -139,16 +139,16 @@ wins_get_chat_unsubscribed(void)
     return result;
 }
 
-ProfMucConfWin*
-wins_get_muc_conf(const char *const roomjid)
+ProfConfWin*
+wins_get_conf(const char *const roomjid)
 {
     GList *values = g_hash_table_get_values(windows);
     GList *curr = values;
 
     while (curr) {
         ProfWin *window = curr->data;
-        if (window->type == WIN_MUC_CONFIG) {
-            ProfMucConfWin *confwin = (ProfMucConfWin*)window;
+        if (window->type == WIN_CONFIG) {
+            ProfConfWin *confwin = (ProfConfWin*)window;
             if (g_strcmp0(confwin->roomjid, roomjid) == 0) {
                 g_list_free(values);
                 return confwin;
@@ -364,7 +364,7 @@ wins_get_by_num(int i)
 }
 
 ProfWin*
-wins_get_by_string(char *str)
+wins_get_by_string(const char *str)
 {
     if (g_strcmp0(str, "console") == 0) {
         ProfWin *conswin = wins_get_console();
@@ -584,7 +584,7 @@ wins_close_by_num(int i)
                 autocomplete_remove(wins_close_ac, pluginwin->tag);
                 break;
             }
-            case WIN_MUC_CONFIG:
+            case WIN_CONFIG:
             default:
                 break;
             }
@@ -657,12 +657,12 @@ wins_new_muc(const char *const roomjid)
 }
 
 ProfWin*
-wins_new_muc_config(const char *const roomjid, DataForm *form)
+wins_new_config(const char *const roomjid, DataForm *form, ProfConfWinCallback submit, ProfConfWinCallback cancel, const void *userdata)
 {
     GList *keys = g_hash_table_get_keys(windows);
     int result = _wins_get_next_available_num(keys);
     g_list_free(keys);
-    ProfWin *newwin = win_create_muc_config(roomjid, form);
+    ProfWin *newwin = win_create_config(roomjid, form, submit, cancel, userdata);
     g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
     return newwin;
 }
@@ -812,7 +812,7 @@ wins_get_prune_wins(void)
         ProfWin *window = curr->data;
         if (win_unread(window) == 0 &&
                 window->type != WIN_MUC &&
-                window->type != WIN_MUC_CONFIG &&
+                window->type != WIN_CONFIG &&
                 window->type != WIN_XML &&
                 window->type != WIN_CONSOLE) {
             result = g_slist_append(result, window);
diff --git a/src/ui/window_list.h b/src/ui/window_list.h
index 68e72739..b47ee79f 100644
--- a/src/ui/window_list.h
+++ b/src/ui/window_list.h
@@ -42,7 +42,7 @@ void wins_init(void);
 ProfWin* wins_new_xmlconsole(void);
 ProfWin* wins_new_chat(const char *const barejid);
 ProfWin* wins_new_muc(const char *const roomjid);
-ProfWin* wins_new_muc_config(const char *const roomjid, DataForm *form);
+ProfWin* wins_new_config(const char *const roomjid, DataForm *form, ProfConfWinCallback submit, ProfConfWinCallback cancel, const void *userdata);
 ProfWin* wins_new_private(const char *const fulljid);
 ProfWin* wins_new_plugin(const char *const plugin_name, const char *const tag);
 
@@ -56,7 +56,7 @@ ProfWin* wins_get_console(void);
 ProfChatWin* wins_get_chat(const char *const barejid);
 GList* wins_get_chat_unsubscribed(void);
 ProfMucWin* wins_get_muc(const char *const roomjid);
-ProfMucConfWin* wins_get_muc_conf(const char *const roomjid);
+ProfConfWin* wins_get_conf(const char *const roomjid);
 ProfPrivateWin* wins_get_private(const char *const fulljid);
 ProfPluginWin* wins_get_plugin(const char *const tag);
 ProfXMLWin* wins_get_xmlconsole(void);
@@ -68,7 +68,7 @@ ProfWin* wins_get_current(void);
 void wins_set_current_by_num(int i);
 
 ProfWin* wins_get_by_num(int i);
-ProfWin* wins_get_by_string(char *str);
+ProfWin* wins_get_by_string(const char *str);
 
 ProfWin* wins_get_next(void);
 ProfWin* wins_get_previous(void);