mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Moved chat resource to WIN_CHAT type
This commit is contained in:
parent
12d0d22ab3
commit
706f31422d
@ -1782,9 +1782,9 @@ cmd_execute_default(const char * inp)
|
|||||||
} else {
|
} else {
|
||||||
GString *send_recipient = g_string_new(recipient);
|
GString *send_recipient = g_string_new(recipient);
|
||||||
ProfWin *current = wins_get_current();
|
ProfWin *current = wins_get_current();
|
||||||
if (current && current->chat_resource) {
|
if (current && current->wins.chat.chat_resource) {
|
||||||
g_string_append(send_recipient, "/");
|
g_string_append(send_recipient, "/");
|
||||||
g_string_append(send_recipient, current->chat_resource);
|
g_string_append(send_recipient, current->wins.chat.chat_resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBOTR
|
#ifdef HAVE_LIBOTR
|
||||||
|
@ -1151,9 +1151,9 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
|||||||
}
|
}
|
||||||
GString *send_jid = g_string_new(usr_jid);
|
GString *send_jid = g_string_new(usr_jid);
|
||||||
ProfWin *current = wins_get_current();
|
ProfWin *current = wins_get_current();
|
||||||
if (current && current->chat_resource) {
|
if (current->type == WIN_CHAT && current->wins.chat.chat_resource) {
|
||||||
g_string_append(send_jid, "/");
|
g_string_append(send_jid, "/");
|
||||||
g_string_append(send_jid, current->chat_resource);
|
g_string_append(send_jid, current->wins.chat.chat_resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg != NULL) {
|
if (msg != NULL) {
|
||||||
@ -1574,11 +1574,11 @@ cmd_resource(gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
current->chat_resource = strdup(resource);
|
current->wins.chat.chat_resource = strdup(resource);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} else if (g_strcmp0(cmd, "off") == 0) {
|
} else if (g_strcmp0(cmd, "off") == 0) {
|
||||||
FREE_SET_NULL(current->chat_resource);
|
FREE_SET_NULL(current->wins.chat.chat_resource);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
@ -2941,9 +2941,9 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
|
|||||||
char *recipient = ui_current_recipient();
|
char *recipient = ui_current_recipient();
|
||||||
GString *send_recipient = g_string_new(recipient);
|
GString *send_recipient = g_string_new(recipient);
|
||||||
ProfWin *current = wins_get_current();
|
ProfWin *current = wins_get_current();
|
||||||
if (current && current->chat_resource) {
|
if (current && current->wins.chat.chat_resource) {
|
||||||
g_string_append(send_recipient, "/");
|
g_string_append(send_recipient, "/");
|
||||||
g_string_append(send_recipient, current->chat_resource);
|
g_string_append(send_recipient, current->wins.chat.chat_resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBOTR
|
#ifdef HAVE_LIBOTR
|
||||||
|
@ -888,7 +888,7 @@ _ui_gone_secure(const char * const recipient, gboolean trusted)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE_SET_NULL(window->chat_resource);
|
FREE_SET_NULL(window->wins.chat.chat_resource);
|
||||||
|
|
||||||
window->wins.chat.is_otr = TRUE;
|
window->wins.chat.is_otr = TRUE;
|
||||||
window->wins.chat.is_trusted = trusted;
|
window->wins.chat.is_trusted = trusted;
|
||||||
|
@ -324,21 +324,21 @@ _show_contact_presence(void)
|
|||||||
int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
|
int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
|
||||||
|
|
||||||
ProfWin *current = wins_get_current();
|
ProfWin *current = wins_get_current();
|
||||||
if (current && current->chat_resource) {
|
if (current && current->wins.chat.chat_resource) {
|
||||||
wprintw(win, "/");
|
wprintw(win, "/");
|
||||||
wprintw(win, current->chat_resource);
|
wprintw(win, current->wins.chat.chat_resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_PRESENCE)) {
|
if (prefs_get_boolean(PREF_PRESENCE)) {
|
||||||
theme_item_t presence_colour = THEME_TITLE_OFFLINE;
|
theme_item_t presence_colour = THEME_TITLE_OFFLINE;
|
||||||
const char *presence = "offline";
|
const char *presence = "offline";
|
||||||
|
|
||||||
if (current && current->chat_resource) {
|
if (current && current->wins.chat.chat_resource) {
|
||||||
char *barejid = roster_barejid_from_name(current_recipient);
|
char *barejid = roster_barejid_from_name(current_recipient);
|
||||||
if (barejid) {
|
if (barejid) {
|
||||||
PContact contact = roster_get_contact(barejid);
|
PContact contact = roster_get_contact(barejid);
|
||||||
if (contact) {
|
if (contact) {
|
||||||
Resource *resource = p_contact_get_resource(contact, current->chat_resource);
|
Resource *resource = p_contact_get_resource(contact, current->wins.chat.chat_resource);
|
||||||
if (resource) {
|
if (resource) {
|
||||||
presence = string_from_resource_presence(resource->presence);
|
presence = string_from_resource_presence(resource->presence);
|
||||||
}
|
}
|
||||||
|
@ -122,10 +122,9 @@ win_create(const char * const title, win_type_t type)
|
|||||||
if (new_win->type == WIN_CHAT) {
|
if (new_win->type == WIN_CHAT) {
|
||||||
new_win->wins.chat.is_otr = FALSE;
|
new_win->wins.chat.is_otr = FALSE;
|
||||||
new_win->wins.chat.is_trusted = FALSE;
|
new_win->wins.chat.is_trusted = FALSE;
|
||||||
|
new_win->wins.chat.chat_resource = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_win->chat_resource = NULL;
|
|
||||||
|
|
||||||
scrollok(new_win->win, TRUE);
|
scrollok(new_win->win, TRUE);
|
||||||
|
|
||||||
return new_win;
|
return new_win;
|
||||||
@ -223,7 +222,10 @@ win_free(ProfWin* window)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(window->chat_resource);
|
if (window->type == WIN_CHAT) {
|
||||||
|
free(window->wins.chat.chat_resource);
|
||||||
|
}
|
||||||
|
|
||||||
free(window->from);
|
free(window->from);
|
||||||
|
|
||||||
if (window->type == WIN_MUC_CONFIG) {
|
if (window->type == WIN_MUC_CONFIG) {
|
||||||
|
@ -71,7 +71,6 @@ typedef struct prof_win_t {
|
|||||||
WINDOW *win;
|
WINDOW *win;
|
||||||
ProfBuff buffer;
|
ProfBuff buffer;
|
||||||
char *from;
|
char *from;
|
||||||
char *chat_resource;
|
|
||||||
int y_pos;
|
int y_pos;
|
||||||
int paged;
|
int paged;
|
||||||
int unread;
|
int unread;
|
||||||
@ -87,6 +86,7 @@ typedef struct prof_win_t {
|
|||||||
struct {
|
struct {
|
||||||
gboolean is_otr;
|
gboolean is_otr;
|
||||||
gboolean is_trusted;
|
gboolean is_trusted;
|
||||||
|
char *chat_resource;
|
||||||
} chat;
|
} chat;
|
||||||
|
|
||||||
// WIN_MUC
|
// WIN_MUC
|
||||||
|
Loading…
Reference in New Issue
Block a user