Implement XEP-0363: HTTP File Upload
This commit is contained in:
@@ -125,6 +125,21 @@ buffer_yield_entry(ProfBuff buffer, int entry)
|
||||
return node->data;
|
||||
}
|
||||
|
||||
ProfBuffEntry*
|
||||
buffer_yield_entry_by_id(ProfBuff buffer, const char *const id)
|
||||
{
|
||||
GSList *entries = buffer->entries;
|
||||
while (entries) {
|
||||
ProfBuffEntry *entry = entries->data;
|
||||
if (entry->receipt && g_strcmp0(entry->receipt->id, id) == 0) {
|
||||
return entry;
|
||||
}
|
||||
entries = g_slist_next(entries);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_entry(ProfBuffEntry *entry)
|
||||
{
|
||||
|
||||
@@ -64,6 +64,7 @@ void buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTim
|
||||
const char *const from, const char *const message, DeliveryReceipt *receipt);
|
||||
int buffer_size(ProfBuff buffer);
|
||||
ProfBuffEntry* buffer_yield_entry(ProfBuff buffer, int entry);
|
||||
ProfBuffEntry* buffer_yield_entry_by_id(ProfBuff buffer, const char *const id);
|
||||
gboolean buffer_mark_received(ProfBuff buffer, const char *const id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <wchar.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
@@ -145,7 +146,9 @@ inp_readline(void)
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fileno(rl_instream), &fds);
|
||||
errno = 0;
|
||||
pthread_mutex_unlock(&lock);
|
||||
r = select(FD_SETSIZE, &fds, NULL, NULL, &p_rl_timeout);
|
||||
pthread_mutex_lock(&lock);
|
||||
if (r < 0) {
|
||||
if (errno != EINTR) {
|
||||
char *err_msg = strerror(errno);
|
||||
|
||||
@@ -1054,6 +1054,27 @@ win_mark_received(ProfWin *window, const char *const id)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
win_update_entry_message(ProfWin *window, const char *const id, const char *const message)
|
||||
{
|
||||
ProfBuffEntry *entry = buffer_yield_entry_by_id(window->layout->buffer, id);
|
||||
if (entry) {
|
||||
free(entry->message);
|
||||
entry->message = strdup(message);
|
||||
win_redraw(window);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
win_update_entry_theme(ProfWin *window, const char *const id, theme_item_t theme_item)
|
||||
{
|
||||
ProfBuffEntry *entry = buffer_yield_entry_by_id(window->layout->buffer, id);
|
||||
if (entry) {
|
||||
entry->theme_item = theme_item;
|
||||
win_redraw(window);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
win_println(ProfWin *window, int pad, const char *const message)
|
||||
{
|
||||
|
||||
@@ -70,6 +70,8 @@ int win_occpuants_cols(void);
|
||||
void win_sub_print(WINDOW *win, char *msg, gboolean newline, gboolean wrap, int indent);
|
||||
void win_sub_newline_lazy(WINDOW *win);
|
||||
void win_mark_received(ProfWin *window, const char *const id);
|
||||
void win_update_entry_message(ProfWin *window, const char *const id, const char *const message);
|
||||
void win_update_entry_theme(ProfWin *window, const char *const id, theme_item_t theme_item);
|
||||
|
||||
gboolean win_has_active_subwin(ProfWin *window);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user