mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Send clipboard via /paste
New command `/paste` that sends the clipboard in MUC, Chat etc windows. Fix https://github.com/profanity-im/profanity/issues/156
This commit is contained in:
parent
900a0451a7
commit
291f9de1e9
@ -8581,8 +8581,40 @@ gboolean
|
|||||||
cmd_paste(ProfWin *window, const char *const command, gchar **args)
|
cmd_paste(ProfWin *window, const char *const command, gchar **args)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GTK
|
#ifdef HAVE_GTK
|
||||||
char *buf = clipboard_get();
|
char *clipboard_buffer = clipboard_get();
|
||||||
cons_show(buf);
|
|
||||||
|
if (clipboard_buffer) {
|
||||||
|
switch (window->type) {
|
||||||
|
case WIN_MUC:
|
||||||
|
{
|
||||||
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
cl_ev_send_muc_msg(mucwin, clipboard_buffer, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WIN_CHAT:
|
||||||
|
{
|
||||||
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
|
cl_ev_send_msg(chatwin, clipboard_buffer, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WIN_PRIVATE:
|
||||||
|
{
|
||||||
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
|
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
||||||
|
cl_ev_send_priv_msg(privatewin, clipboard_buffer, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WIN_CONSOLE:
|
||||||
|
case WIN_XML:
|
||||||
|
default:
|
||||||
|
cons_bad_cmd_usage(command);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(clipboard_buffer);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
cons_show("This version of Profanity has not been built with GTK support enabled. It is needed for the clipboard feature to work.");
|
cons_show("This version of Profanity has not been built with GTK support enabled. It is needed for the clipboard feature to work.");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user