mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 00:16:22 +00:00
Added /duck command to perform searches using duckduckgo chat bot
This commit is contained in:
@@ -205,6 +205,20 @@ ui_windows_full(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ui_duck_exists(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < NUM_WINS; i++) {
|
||||
if (windows[i] != NULL) {
|
||||
if (windows[i]->type == WIN_DUCK)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
ui_contact_typing(const char * const from)
|
||||
{
|
||||
@@ -712,6 +726,54 @@ ui_new_chat_win(const char * const to)
|
||||
ui_switch_win(win_index);
|
||||
}
|
||||
|
||||
void
|
||||
ui_create_duck_win(void)
|
||||
{
|
||||
int win_index = _new_prof_win("DuckDuckGo search", WIN_DUCK);
|
||||
ui_switch_win(win_index);
|
||||
win_print_time(windows[win_index], '-');
|
||||
wprintw(windows[win_index]->win, "Type ':help' to find out more.\n");
|
||||
}
|
||||
|
||||
void
|
||||
ui_open_duck_win(void)
|
||||
{
|
||||
int win_index = _find_prof_win_index("DuckDuckGo search");
|
||||
if (win_index != NUM_WINS) {
|
||||
ui_switch_win(win_index);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_duck(const char * const query)
|
||||
{
|
||||
int win_index = _find_prof_win_index("DuckDuckGo search");
|
||||
if (win_index != NUM_WINS) {
|
||||
win_print_time(windows[win_index], '-');
|
||||
wprintw(windows[win_index]->win, "\n");
|
||||
win_print_time(windows[win_index], '-');
|
||||
wattron(windows[win_index]->win, COLOUR_ME);
|
||||
wprintw(windows[win_index]->win, "Query : ");
|
||||
wattroff(windows[win_index]->win, COLOUR_ME);
|
||||
wprintw(windows[win_index]->win, query);
|
||||
wprintw(windows[win_index]->win, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_duck_result(const char * const result)
|
||||
{
|
||||
int win_index = _find_prof_win_index("DuckDuckGo search");
|
||||
if (win_index != NUM_WINS) {
|
||||
win_print_time(windows[win_index], '-');
|
||||
wattron(windows[win_index]->win, COLOUR_THEM);
|
||||
wprintw(windows[win_index]->win, "Result : ");
|
||||
wattroff(windows[win_index]->win, COLOUR_THEM);
|
||||
wprintw(windows[win_index]->win, result);
|
||||
wprintw(windows[win_index]->win, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_outgoing_msg(const char * const from, const char * const to,
|
||||
const char * const message)
|
||||
|
||||
Reference in New Issue
Block a user