mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Removed wins_get_current_* functions
This commit is contained in:
parent
a798dc5618
commit
e00a03f916
@ -1810,7 +1810,8 @@ cmd_reset_autocomplete(ProfWin *window)
|
|||||||
autocomplete_reset(receipts_ac);
|
autocomplete_reset(receipts_ac);
|
||||||
|
|
||||||
if (window->type == WIN_CHAT) {
|
if (window->type == WIN_CHAT) {
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
PContact contact = roster_get_contact(chatwin->barejid);
|
PContact contact = roster_get_contact(chatwin->barejid);
|
||||||
if (contact) {
|
if (contact) {
|
||||||
p_contact_resource_ac_reset(contact);
|
p_contact_resource_ac_reset(contact);
|
||||||
@ -1818,13 +1819,15 @@ cmd_reset_autocomplete(ProfWin *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
muc_autocomplete_reset(mucwin->roomjid);
|
muc_autocomplete_reset(mucwin->roomjid);
|
||||||
muc_jid_autocomplete_reset(mucwin->roomjid);
|
muc_jid_autocomplete_reset(mucwin->roomjid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->type == WIN_MUC_CONFIG) {
|
if (window->type == WIN_MUC_CONFIG) {
|
||||||
ProfMucConfWin *confwin = wins_get_current_muc_conf();
|
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
|
||||||
|
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
|
||||||
if (confwin->form) {
|
if (confwin->form) {
|
||||||
form_reset_autocompleters(confwin->form);
|
form_reset_autocompleters(confwin->form);
|
||||||
}
|
}
|
||||||
@ -1938,7 +1941,8 @@ _cmd_complete_parameters(ProfWin *window, const char * const input)
|
|||||||
|
|
||||||
// autocomplete nickname in chat rooms
|
// autocomplete nickname in chat rooms
|
||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
|
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
|
||||||
if (nick_ac) {
|
if (nick_ac) {
|
||||||
gchar *nick_choices[] = { "/msg", "/info", "/caps", "/status", "/software" } ;
|
gchar *nick_choices[] = { "/msg", "/info", "/caps", "/status", "/software" } ;
|
||||||
@ -2477,7 +2481,8 @@ _resource_autocomplete(ProfWin *window, const char * const input)
|
|||||||
char *found = NULL;
|
char *found = NULL;
|
||||||
|
|
||||||
if (window->type == WIN_CHAT) {
|
if (window->type == WIN_CHAT) {
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
PContact contact = roster_get_contact(chatwin->barejid);
|
PContact contact = roster_get_contact(chatwin->barejid);
|
||||||
if (contact) {
|
if (contact) {
|
||||||
Autocomplete ac = p_contact_resource_ac(contact);
|
Autocomplete ac = p_contact_resource_ac(contact);
|
||||||
@ -2705,7 +2710,8 @@ _kick_autocomplete(ProfWin *window, const char * const input)
|
|||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
|
|
||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
|
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
|
||||||
|
|
||||||
if (nick_ac) {
|
if (nick_ac) {
|
||||||
@ -2725,7 +2731,8 @@ _ban_autocomplete(ProfWin *window, const char * const input)
|
|||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
|
|
||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
Autocomplete jid_ac = muc_roster_jid_ac(mucwin->roomjid);
|
Autocomplete jid_ac = muc_roster_jid_ac(mucwin->roomjid);
|
||||||
|
|
||||||
if (jid_ac) {
|
if (jid_ac) {
|
||||||
@ -2745,7 +2752,8 @@ _affiliation_autocomplete(ProfWin *window, const char * const input)
|
|||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
|
|
||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
gboolean parse_result;
|
gboolean parse_result;
|
||||||
Autocomplete jid_ac = muc_roster_jid_ac(mucwin->roomjid);
|
Autocomplete jid_ac = muc_roster_jid_ac(mucwin->roomjid);
|
||||||
|
|
||||||
@ -2792,7 +2800,8 @@ _role_autocomplete(ProfWin *window, const char * const input)
|
|||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
|
|
||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
gboolean parse_result;
|
gboolean parse_result;
|
||||||
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
|
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
|
||||||
|
|
||||||
|
@ -108,19 +108,22 @@ cmd_execute_default(ProfWin *window, const char * inp)
|
|||||||
switch (window->type) {
|
switch (window->type) {
|
||||||
case WIN_CHAT:
|
case WIN_CHAT:
|
||||||
{
|
{
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
cl_ev_send_msg(chatwin, inp);
|
cl_ev_send_msg(chatwin, inp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WIN_PRIVATE:
|
case WIN_PRIVATE:
|
||||||
{
|
{
|
||||||
ProfPrivateWin *privatewin = wins_get_current_private();
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
|
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
||||||
cl_ev_send_priv_msg(privatewin, inp);
|
cl_ev_send_priv_msg(privatewin, inp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
{
|
{
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
cl_ev_send_muc_msg(mucwin, inp);
|
cl_ev_send_muc_msg(mucwin, inp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -600,7 +603,8 @@ cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jid == NULL) {
|
if (jid == NULL) {
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
jid = chatwin->barejid;
|
jid = chatwin->barejid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -968,7 +972,8 @@ _who_room(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
|
||||||
// presence filter
|
// presence filter
|
||||||
if (args[0] == NULL ||
|
if (args[0] == NULL ||
|
||||||
@ -1316,7 +1321,8 @@ cmd_msg(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
// send private message when in MUC room
|
// send private message when in MUC room
|
||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
if (muc_roster_contains_nick(mucwin->roomjid, usr)) {
|
if (muc_roster_contains_nick(mucwin->roomjid, usr)) {
|
||||||
GString *full_jid = g_string_new(mucwin->roomjid);
|
GString *full_jid = g_string_new(mucwin->roomjid);
|
||||||
g_string_append(full_jid, "/");
|
g_string_append(full_jid, "/");
|
||||||
@ -1789,7 +1795,8 @@ cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
if (usr) {
|
if (usr) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
Occupant *occupant = muc_roster_item(mucwin->roomjid, usr);
|
Occupant *occupant = muc_roster_item(mucwin->roomjid, usr);
|
||||||
if (occupant) {
|
if (occupant) {
|
||||||
win_show_occupant(window, occupant);
|
win_show_occupant(window, occupant);
|
||||||
@ -1804,7 +1811,8 @@ cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
if (usr) {
|
if (usr) {
|
||||||
ui_current_print_line("No parameter required when in chat.");
|
ui_current_print_line("No parameter required when in chat.");
|
||||||
} else {
|
} else {
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
PContact pcontact = roster_get_contact(chatwin->barejid);
|
PContact pcontact = roster_get_contact(chatwin->barejid);
|
||||||
if (pcontact) {
|
if (pcontact) {
|
||||||
win_show_contact(window, pcontact);
|
win_show_contact(window, pcontact);
|
||||||
@ -1817,7 +1825,8 @@ cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
if (usr) {
|
if (usr) {
|
||||||
ui_current_print_line("No parameter required when in chat.");
|
ui_current_print_line("No parameter required when in chat.");
|
||||||
} else {
|
} else {
|
||||||
ProfPrivateWin *privatewin = wins_get_current_private();
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
|
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
||||||
Jid *jid = jid_create(privatewin->fulljid);
|
Jid *jid = jid_create(privatewin->fulljid);
|
||||||
Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart);
|
Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart);
|
||||||
if (occupant) {
|
if (occupant) {
|
||||||
@ -1863,7 +1872,8 @@ cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
if (usr) {
|
if (usr) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
Occupant *occupant = muc_roster_item(mucwin->roomjid, usr);
|
Occupant *occupant = muc_roster_item(mucwin->roomjid, usr);
|
||||||
if (occupant) {
|
if (occupant) {
|
||||||
win_show_occupant_info(window, mucwin->roomjid, occupant);
|
win_show_occupant_info(window, mucwin->roomjid, occupant);
|
||||||
@ -1871,7 +1881,8 @@ cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
ui_current_print_line("No such occupant \"%s\" in room.", usr);
|
ui_current_print_line("No such occupant \"%s\" in room.", usr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
iq_room_info_request(mucwin->roomjid, TRUE);
|
iq_room_info_request(mucwin->roomjid, TRUE);
|
||||||
ui_show_room_info(mucwin);
|
ui_show_room_info(mucwin);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1881,7 +1892,8 @@ cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
if (usr) {
|
if (usr) {
|
||||||
ui_current_print_line("No parameter required when in chat.");
|
ui_current_print_line("No parameter required when in chat.");
|
||||||
} else {
|
} else {
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
PContact pcontact = roster_get_contact(chatwin->barejid);
|
PContact pcontact = roster_get_contact(chatwin->barejid);
|
||||||
if (pcontact) {
|
if (pcontact) {
|
||||||
win_show_info(window, pcontact);
|
win_show_info(window, pcontact);
|
||||||
@ -1894,7 +1906,8 @@ cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
if (usr) {
|
if (usr) {
|
||||||
ui_current_print_line("No parameter required when in chat.");
|
ui_current_print_line("No parameter required when in chat.");
|
||||||
} else {
|
} else {
|
||||||
ProfPrivateWin *privatewin = wins_get_current_private();
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
|
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
||||||
Jid *jid = jid_create(privatewin->fulljid);
|
Jid *jid = jid_create(privatewin->fulljid);
|
||||||
Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart);
|
Occupant *occupant = muc_roster_item(jid->barejid, jid->resourcepart);
|
||||||
if (occupant) {
|
if (occupant) {
|
||||||
@ -1944,7 +1957,8 @@ cmd_caps(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
occupant = muc_roster_item(mucwin->roomjid, args[0]);
|
occupant = muc_roster_item(mucwin->roomjid, args[0]);
|
||||||
if (occupant) {
|
if (occupant) {
|
||||||
Jid *jidp = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
|
Jid *jidp = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
|
||||||
@ -1986,7 +2000,8 @@ cmd_caps(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
cons_show("No parameter needed to /caps when in private chat.");
|
cons_show("No parameter needed to /caps when in private chat.");
|
||||||
} else {
|
} else {
|
||||||
ProfPrivateWin *privatewin = wins_get_current_private();
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
|
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
||||||
Jid *jid = jid_create(privatewin->fulljid);
|
Jid *jid = jid_create(privatewin->fulljid);
|
||||||
if (jid) {
|
if (jid) {
|
||||||
occupant = muc_roster_item(jid->barejid, jid->resourcepart);
|
occupant = muc_roster_item(jid->barejid, jid->resourcepart);
|
||||||
@ -2018,7 +2033,8 @@ cmd_software(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
occupant = muc_roster_item(mucwin->roomjid, args[0]);
|
occupant = muc_roster_item(mucwin->roomjid, args[0]);
|
||||||
if (occupant) {
|
if (occupant) {
|
||||||
Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
|
Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
|
||||||
@ -2050,7 +2066,8 @@ cmd_software(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
cons_show("No parameter needed to /software when in private chat.");
|
cons_show("No parameter needed to /software when in private chat.");
|
||||||
} else {
|
} else {
|
||||||
ProfPrivateWin *privatewin = wins_get_current_private();
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
|
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
||||||
iq_send_software_version(privatewin->fulljid);
|
iq_send_software_version(privatewin->fulljid);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2180,7 +2197,8 @@ cmd_invite(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
usr_jid = contact;
|
usr_jid = contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
message_send_invite(mucwin->roomjid, usr_jid, reason);
|
message_send_invite(mucwin->roomjid, usr_jid, reason);
|
||||||
if (reason) {
|
if (reason) {
|
||||||
cons_show("Room invite sent, contact: %s, room: %s, reason: \"%s\".",
|
cons_show("Room invite sent, contact: %s, room: %s, reason: \"%s\".",
|
||||||
@ -2456,7 +2474,8 @@ cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucConfWin *confwin = wins_get_current_muc_conf();
|
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
|
||||||
|
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
|
||||||
|
|
||||||
if (g_strcmp0(args[0], "show") == 0) {
|
if (g_strcmp0(args[0], "show") == 0) {
|
||||||
ui_show_form(confwin);
|
ui_show_form(confwin);
|
||||||
@ -2521,7 +2540,8 @@ cmd_kick(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
|
||||||
char *nick = args[0];
|
char *nick = args[0];
|
||||||
if (nick) {
|
if (nick) {
|
||||||
@ -2553,7 +2573,8 @@ cmd_ban(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
|
||||||
char *jid = args[0];
|
char *jid = args[0];
|
||||||
if (jid) {
|
if (jid) {
|
||||||
@ -2580,7 +2601,8 @@ cmd_subject(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
|
||||||
if (args[0] == NULL) {
|
if (args[0] == NULL) {
|
||||||
char *subject = muc_subject(mucwin->roomjid);
|
char *subject = muc_subject(mucwin->roomjid);
|
||||||
@ -2643,7 +2665,8 @@ cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
|
||||||
if (g_strcmp0(cmd, "list") == 0) {
|
if (g_strcmp0(cmd, "list") == 0) {
|
||||||
if (!affiliation) {
|
if (!affiliation) {
|
||||||
@ -2711,7 +2734,8 @@ cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
|
||||||
if (g_strcmp0(cmd, "list") == 0) {
|
if (g_strcmp0(cmd, "list") == 0) {
|
||||||
if (!role) {
|
if (!role) {
|
||||||
@ -2769,7 +2793,8 @@ cmd_room(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
int num = wins_get_num(window);
|
int num = wins_get_num(window);
|
||||||
|
|
||||||
int ui_index = num;
|
int ui_index = num;
|
||||||
@ -2870,7 +2895,8 @@ cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
|
|
||||||
if (g_strcmp0(args[0], "show") == 0) {
|
if (g_strcmp0(args[0], "show") == 0) {
|
||||||
if (g_strcmp0(args[1], "jid") == 0) {
|
if (g_strcmp0(args[1], "jid") == 0) {
|
||||||
@ -2927,7 +2953,8 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
gchar *cmd = args[0];
|
gchar *cmd = args[0];
|
||||||
if (window->type == WIN_MUC && cmd == NULL) {
|
if (window->type == WIN_MUC && cmd == NULL) {
|
||||||
// default to current nickname, password, and autojoin "on"
|
// default to current nickname, password, and autojoin "on"
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
char *nick = muc_nick(mucwin->roomjid);
|
char *nick = muc_nick(mucwin->roomjid);
|
||||||
char *password = muc_password(mucwin->roomjid);
|
char *password = muc_password(mucwin->roomjid);
|
||||||
gboolean added = bookmark_add(mucwin->roomjid, nick, password, "on");
|
gboolean added = bookmark_add(mucwin->roomjid, nick, password, "on");
|
||||||
@ -3068,7 +3095,8 @@ cmd_nick(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
char *nick = args[0];
|
char *nick = args[0];
|
||||||
presence_change_room_nick(mucwin->roomjid, nick);
|
presence_change_room_nick(mucwin->roomjid, nick);
|
||||||
|
|
||||||
@ -3171,19 +3199,22 @@ cmd_tiny(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
switch (window->type){
|
switch (window->type){
|
||||||
case WIN_CHAT:
|
case WIN_CHAT:
|
||||||
{
|
{
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
cl_ev_send_msg(chatwin, tiny);
|
cl_ev_send_msg(chatwin, tiny);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WIN_PRIVATE:
|
case WIN_PRIVATE:
|
||||||
{
|
{
|
||||||
ProfPrivateWin *privatewin = wins_get_current_private();
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
|
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
||||||
cl_ev_send_priv_msg(privatewin, tiny);
|
cl_ev_send_priv_msg(privatewin, tiny);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WIN_MUC:
|
case WIN_MUC:
|
||||||
{
|
{
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
cl_ev_send_muc_msg(mucwin, tiny);
|
cl_ev_send_muc_msg(mucwin, tiny);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4182,7 +4213,8 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
||||||
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4234,7 +4266,8 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
if (chatwin->enc_mode == PROF_ENC_OTR) {
|
if (chatwin->enc_mode == PROF_ENC_OTR) {
|
||||||
ui_current_print_formatted_line('!', 0, "You are already in an OTR session.");
|
ui_current_print_formatted_line('!', 0, "You are already in an OTR session.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4256,7 +4289,8 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
||||||
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4272,7 +4306,8 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
||||||
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4288,7 +4323,8 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
||||||
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4304,7 +4340,8 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
||||||
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4332,7 +4369,8 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
||||||
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4347,7 +4385,8 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
if (chatwin->enc_mode != PROF_ENC_OTR) {
|
||||||
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
@ -666,7 +667,8 @@ char *
|
|||||||
muc_autocomplete(ProfWin *window, const char * const input)
|
muc_autocomplete(ProfWin *window, const char * const input)
|
||||||
{
|
{
|
||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, mucwin->roomjid);
|
ChatRoom *chat_room = g_hash_table_lookup(rooms, mucwin->roomjid);
|
||||||
|
|
||||||
if (chat_room && chat_room->nick_ac) {
|
if (chat_room && chat_room->nick_ac) {
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
@ -134,7 +135,8 @@ prof_handle_activity(void)
|
|||||||
ProfWin *current = wins_get_current();
|
ProfWin *current = wins_get_current();
|
||||||
|
|
||||||
if ((status == JABBER_CONNECTED) && (current->type == WIN_CHAT)) {
|
if ((status == JABBER_CONNECTED) && (current->type == WIN_CHAT)) {
|
||||||
ProfChatWin *chatwin = wins_get_current_chat();
|
ProfChatWin *chatwin = (ProfChatWin*)current;
|
||||||
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
chat_state_handle_typing(chatwin->barejid, chatwin->state);
|
chat_state_handle_typing(chatwin->barejid, chatwin->state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,74 +167,6 @@ wins_get_current(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfChatWin *
|
|
||||||
wins_get_current_chat(void)
|
|
||||||
{
|
|
||||||
if (windows) {
|
|
||||||
ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(current));
|
|
||||||
if (window) {
|
|
||||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
|
||||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
|
||||||
return chatwin;
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ProfMucWin *
|
|
||||||
wins_get_current_muc(void)
|
|
||||||
{
|
|
||||||
if (windows) {
|
|
||||||
ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(current));
|
|
||||||
if (window) {
|
|
||||||
ProfMucWin *mucwin = (ProfMucWin*)window;
|
|
||||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
|
||||||
return mucwin;
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ProfPrivateWin *
|
|
||||||
wins_get_current_private(void)
|
|
||||||
{
|
|
||||||
if (windows) {
|
|
||||||
ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(current));
|
|
||||||
if (window) {
|
|
||||||
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
|
||||||
assert(privatewin->memcheck == PROFPRIVATEWIN_MEMCHECK);
|
|
||||||
return privatewin;
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ProfMucConfWin *
|
|
||||||
wins_get_current_muc_conf(void)
|
|
||||||
{
|
|
||||||
if (windows) {
|
|
||||||
ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(current));
|
|
||||||
if (window) {
|
|
||||||
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
|
|
||||||
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
|
|
||||||
return confwin;
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GList *
|
GList *
|
||||||
wins_get_nums(void)
|
wins_get_nums(void)
|
||||||
{
|
{
|
||||||
|
@ -53,10 +53,6 @@ ProfPrivateWin *wins_get_private(const char * const fulljid);
|
|||||||
ProfXMLWin * wins_get_xmlconsole(void);
|
ProfXMLWin * wins_get_xmlconsole(void);
|
||||||
|
|
||||||
ProfWin * wins_get_current(void);
|
ProfWin * wins_get_current(void);
|
||||||
ProfChatWin * wins_get_current_chat(void);
|
|
||||||
ProfMucWin * wins_get_current_muc(void);
|
|
||||||
ProfPrivateWin * wins_get_current_private(void);
|
|
||||||
ProfMucConfWin * wins_get_current_muc_conf(void);
|
|
||||||
|
|
||||||
void wins_set_current_by_num(int i);
|
void wins_set_current_by_num(int i);
|
||||||
|
|
||||||
|
@ -423,30 +423,23 @@ void cmd_otr_theirfp_shows_message_when_in_private(void **state)
|
|||||||
|
|
||||||
void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(void **state)
|
void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(void **state)
|
||||||
{
|
{
|
||||||
char *recipient = "someuser@someserver.com";
|
|
||||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
gchar *args[] = { "theirfp", NULL };
|
gchar *args[] = { "theirfp", NULL };
|
||||||
|
|
||||||
ProfWin window;
|
ProfWin window;
|
||||||
window.type = WIN_CHAT;
|
window.type = WIN_CHAT;
|
||||||
|
ProfChatWin chatwin;
|
||||||
|
chatwin.window = window;
|
||||||
|
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||||
|
|
||||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||||
|
|
||||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
|
||||||
chatwin->barejid = strdup(recipient);
|
|
||||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
|
||||||
will_return(win_create_chat, &chatwin->window);
|
|
||||||
|
|
||||||
wins_init();
|
|
||||||
wins_new_chat(recipient);
|
|
||||||
wins_set_current_by_num(2);
|
|
||||||
|
|
||||||
expect_ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
expect_ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||||
|
|
||||||
gboolean result = cmd_otr(&window, args, *help);
|
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
|
|
||||||
free(help);
|
free(help);
|
||||||
wins_close_current();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmd_otr_theirfp_shows_fingerprint(void **state)
|
void cmd_otr_theirfp_shows_fingerprint(void **state)
|
||||||
@ -458,32 +451,27 @@ void cmd_otr_theirfp_shows_fingerprint(void **state)
|
|||||||
GString *message = g_string_new(recipient);
|
GString *message = g_string_new(recipient);
|
||||||
g_string_append(message, "'s OTR fingerprint: ");
|
g_string_append(message, "'s OTR fingerprint: ");
|
||||||
g_string_append(message, fingerprint);
|
g_string_append(message, fingerprint);
|
||||||
|
|
||||||
ProfWin window;
|
ProfWin window;
|
||||||
window.type = WIN_CHAT;
|
window.type = WIN_CHAT;
|
||||||
|
ProfChatWin chatwin;
|
||||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
chatwin.window = window;
|
||||||
chatwin->barejid = strdup(recipient);
|
chatwin.barejid = recipient;
|
||||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||||
chatwin->enc_mode = PROF_ENC_OTR;
|
chatwin.enc_mode = PROF_ENC_OTR;
|
||||||
will_return(win_create_chat, &chatwin->window);
|
|
||||||
|
|
||||||
wins_init();
|
|
||||||
wins_new_chat(recipient);
|
|
||||||
wins_set_current_by_num(2);
|
|
||||||
|
|
||||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||||
|
|
||||||
expect_string(otr_get_their_fingerprint, recipient, chatwin->barejid);
|
expect_string(otr_get_their_fingerprint, recipient, recipient);
|
||||||
will_return(otr_get_their_fingerprint, strdup(fingerprint));
|
will_return(otr_get_their_fingerprint, strdup(fingerprint));
|
||||||
|
|
||||||
expect_ui_current_print_formatted_line('!', 0, message->str);
|
expect_ui_current_print_formatted_line('!', 0, message->str);
|
||||||
|
|
||||||
gboolean result = cmd_otr(&window, args, *help);
|
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
|
|
||||||
g_string_free(message, TRUE);
|
g_string_free(message, TRUE);
|
||||||
free(help);
|
free(help);
|
||||||
wins_close_current();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -524,28 +512,23 @@ void cmd_otr_start_shows_message_when_already_started(void **state)
|
|||||||
char *recipient = "someone@server.org";
|
char *recipient = "someone@server.org";
|
||||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
gchar *args[] = { "start", NULL };
|
gchar *args[] = { "start", NULL };
|
||||||
ProfWin window;
|
|
||||||
window.type = WIN_CHAT;
|
|
||||||
|
|
||||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||||
|
|
||||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
ProfWin window;
|
||||||
chatwin->barejid = strdup(recipient);
|
window.type = WIN_CHAT;
|
||||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
ProfChatWin chatwin;
|
||||||
chatwin->enc_mode = PROF_ENC_OTR;
|
chatwin.window = window;
|
||||||
will_return(win_create_chat, &chatwin->window);
|
chatwin.barejid = recipient;
|
||||||
|
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||||
wins_init();
|
chatwin.enc_mode = PROF_ENC_OTR;
|
||||||
wins_new_chat(recipient);
|
|
||||||
wins_set_current_by_num(2);
|
|
||||||
|
|
||||||
expect_ui_current_print_formatted_line('!', 0, "You are already in an OTR session.");
|
expect_ui_current_print_formatted_line('!', 0, "You are already in an OTR session.");
|
||||||
|
|
||||||
gboolean result = cmd_otr(&window, args, *help);
|
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
|
|
||||||
free(help);
|
free(help);
|
||||||
wins_close_current();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmd_otr_start_shows_message_when_no_key(void **state)
|
void cmd_otr_start_shows_message_when_no_key(void **state)
|
||||||
@ -553,29 +536,24 @@ void cmd_otr_start_shows_message_when_no_key(void **state)
|
|||||||
char *recipient = "someone@server.org";
|
char *recipient = "someone@server.org";
|
||||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
gchar *args[] = { "start", NULL };
|
gchar *args[] = { "start", NULL };
|
||||||
ProfWin window;
|
|
||||||
window.type = WIN_CHAT;
|
|
||||||
|
|
||||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||||
will_return(otr_key_loaded, FALSE);
|
will_return(otr_key_loaded, FALSE);
|
||||||
|
|
||||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
ProfWin window;
|
||||||
chatwin->barejid = strdup(recipient);
|
window.type = WIN_CHAT;
|
||||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
ProfChatWin chatwin;
|
||||||
chatwin->enc_mode = PROF_ENC_NONE;
|
chatwin.window = window;
|
||||||
will_return(win_create_chat, &chatwin->window);
|
chatwin.barejid = recipient;
|
||||||
|
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||||
wins_init();
|
chatwin.enc_mode = PROF_ENC_NONE;
|
||||||
wins_new_chat(recipient);
|
|
||||||
wins_set_current_by_num(2);
|
|
||||||
|
|
||||||
expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
|
expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
|
||||||
|
|
||||||
gboolean result = cmd_otr(&window, args, *help);
|
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
|
|
||||||
free(help);
|
free(help);
|
||||||
wins_close_current();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -585,30 +563,26 @@ cmd_otr_start_sends_otr_query_message_to_current_recipeint(void **state)
|
|||||||
char *query_message = "?OTR?";
|
char *query_message = "?OTR?";
|
||||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
gchar *args[] = { "start", NULL };
|
gchar *args[] = { "start", NULL };
|
||||||
|
|
||||||
ProfWin window;
|
ProfWin window;
|
||||||
window.type = WIN_CHAT;
|
window.type = WIN_CHAT;
|
||||||
|
ProfChatWin chatwin;
|
||||||
ProfChatWin *chatwin = malloc(sizeof(ProfChatWin));
|
chatwin.window = window;
|
||||||
chatwin->barejid = strdup(recipient);
|
chatwin.barejid = recipient;
|
||||||
chatwin->memcheck = PROFCHATWIN_MEMCHECK;
|
chatwin.memcheck = PROFCHATWIN_MEMCHECK;
|
||||||
will_return(win_create_chat, &chatwin->window);
|
chatwin.enc_mode = PROF_ENC_NONE;
|
||||||
|
|
||||||
wins_init();
|
|
||||||
wins_new_chat(recipient);
|
|
||||||
wins_set_current_by_num(2);
|
|
||||||
|
|
||||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||||
will_return(otr_key_loaded, TRUE);
|
will_return(otr_key_loaded, TRUE);
|
||||||
will_return(otr_start_query, query_message);
|
will_return(otr_start_query, query_message);
|
||||||
|
|
||||||
expect_string(message_send_chat_encrypted, barejid, chatwin->barejid);
|
expect_string(message_send_chat_encrypted, barejid, recipient);
|
||||||
expect_string(message_send_chat_encrypted, msg, query_message);
|
expect_string(message_send_chat_encrypted, msg, query_message);
|
||||||
|
|
||||||
gboolean result = cmd_otr(&window, args, *help);
|
gboolean result = cmd_otr((ProfWin*)&chatwin, args, *help);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
|
|
||||||
free(help);
|
free(help);
|
||||||
wins_close_current();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user