mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 22:56:21 +00:00
Build URL ac upon printing of message in window
This commit is contained in:
@@ -3921,12 +3921,12 @@ _urlopen_autocomplete(ProfWin *window, const char *const input, gboolean previou
|
||||
{
|
||||
char *result = NULL;
|
||||
|
||||
if (window->type == WIN_CONSOLE){
|
||||
return result;
|
||||
if (window->type == WIN_CHAT ||
|
||||
window->type == WIN_MUC ||
|
||||
window->type == WIN_PRIVATE) {
|
||||
result = autocomplete_param_with_func(input, "/urlopen", wins_get_url, previous, window);
|
||||
}
|
||||
|
||||
result = autocomplete_param_no_with_func(input, "/urlopen", 2, buffer_get_url, previous, window->layout->buffer);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -8862,19 +8862,27 @@ cmd_slashguard(ProfWin *window, const char *const command, gchar **args)
|
||||
gboolean
|
||||
cmd_urlopen(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (args[0] == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
if (window->type == WIN_CHAT ||
|
||||
window->type == WIN_MUC ||
|
||||
window->type == WIN_PRIVATE) {
|
||||
|
||||
if (args[0] == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//TODO: make function. see src/xmpp/avatar.c
|
||||
GString *cmd = g_string_new("");
|
||||
|
||||
g_string_append_printf(cmd, "%s %s > /dev/null 2>&1", "xdg-open", args[0]);
|
||||
cons_show("Calling: %s", cmd->str);
|
||||
FILE *stream = popen(cmd->str, "r");
|
||||
|
||||
pclose(stream);
|
||||
g_string_free(cmd, TRUE);
|
||||
} else {
|
||||
cons_show("urlopen not supported in this window");
|
||||
}
|
||||
|
||||
//TODO: make function. see src/xmpp/avatar.c
|
||||
GString *cmd = g_string_new("");
|
||||
|
||||
g_string_append_printf(cmd, "%s %s > /dev/null 2>&1", "xdg-open", args[0]);
|
||||
cons_show("Calling: %s", cmd->str);
|
||||
FILE *stream = popen(cmd->str, "r");
|
||||
|
||||
pclose(stream);
|
||||
g_string_free(cmd, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user