mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into openpgp
This commit is contained in:
commit
10a5f29023
@ -34,3 +34,4 @@ install:
|
|||||||
- rm -rf stabber
|
- rm -rf stabber
|
||||||
- ./bootstrap.sh
|
- ./bootstrap.sh
|
||||||
script: ./configure && make && make check
|
script: ./configure && make && make check
|
||||||
|
after_script: cat test-suite.log
|
||||||
|
@ -1494,13 +1494,13 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
{
|
{
|
||||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||||
|
|
||||||
|
// show roster
|
||||||
|
if (args[0] == NULL) {
|
||||||
if (conn_status != JABBER_CONNECTED) {
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
cons_show("You are not currently connected.");
|
cons_show("You are not currently connected.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// show roster
|
|
||||||
if (args[0] == NULL) {
|
|
||||||
GSList *list = roster_get_contacts();
|
GSList *list = roster_get_contacts();
|
||||||
cons_show_roster(list);
|
cons_show_roster(list);
|
||||||
g_slist_free(list);
|
g_slist_free(list);
|
||||||
@ -1508,6 +1508,11 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
// show roster, only online contacts
|
// show roster, only online contacts
|
||||||
} else if(g_strcmp0(args[0], "online") == 0){
|
} else if(g_strcmp0(args[0], "online") == 0){
|
||||||
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
|
cons_show("You are not currently connected.");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
GSList *list = roster_get_contacts_online();
|
GSList *list = roster_get_contacts_online();
|
||||||
cons_show_roster(list);
|
cons_show_roster(list);
|
||||||
g_slist_free(list);
|
g_slist_free(list);
|
||||||
@ -1525,7 +1530,7 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
if (res) {
|
if (res) {
|
||||||
prefs_set_roster_size(intval);
|
prefs_set_roster_size(intval);
|
||||||
cons_show("Roster screen size set to: %d%%", intval);
|
cons_show("Roster screen size set to: %d%%", intval);
|
||||||
if (prefs_get_boolean(PREF_ROSTER)) {
|
if (conn_status == JABBER_CONNECTED && prefs_get_boolean(PREF_ROSTER)) {
|
||||||
wins_resize_all();
|
wins_resize_all();
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1540,17 +1545,23 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
if (args[1] == NULL) {
|
if (args[1] == NULL) {
|
||||||
cons_show("Roster enabled.");
|
cons_show("Roster enabled.");
|
||||||
prefs_set_boolean(PREF_ROSTER, TRUE);
|
prefs_set_boolean(PREF_ROSTER, TRUE);
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
ui_show_roster();
|
ui_show_roster();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (g_strcmp0(args[1], "offline") == 0) {
|
} else if (g_strcmp0(args[1], "offline") == 0) {
|
||||||
cons_show("Roster offline enabled");
|
cons_show("Roster offline enabled");
|
||||||
prefs_set_boolean(PREF_ROSTER_OFFLINE, TRUE);
|
prefs_set_boolean(PREF_ROSTER_OFFLINE, TRUE);
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (g_strcmp0(args[1], "resource") == 0) {
|
} else if (g_strcmp0(args[1], "resource") == 0) {
|
||||||
cons_show("Roster resource enabled");
|
cons_show("Roster resource enabled");
|
||||||
prefs_set_boolean(PREF_ROSTER_RESOURCE, TRUE);
|
prefs_set_boolean(PREF_ROSTER_RESOURCE, TRUE);
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
@ -1560,17 +1571,23 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
if (args[1] == NULL) {
|
if (args[1] == NULL) {
|
||||||
cons_show("Roster disabled.");
|
cons_show("Roster disabled.");
|
||||||
prefs_set_boolean(PREF_ROSTER, FALSE);
|
prefs_set_boolean(PREF_ROSTER, FALSE);
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
ui_hide_roster();
|
ui_hide_roster();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (g_strcmp0(args[1], "offline") == 0) {
|
} else if (g_strcmp0(args[1], "offline") == 0) {
|
||||||
cons_show("Roster offline disabled");
|
cons_show("Roster offline disabled");
|
||||||
prefs_set_boolean(PREF_ROSTER_OFFLINE, FALSE);
|
prefs_set_boolean(PREF_ROSTER_OFFLINE, FALSE);
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (g_strcmp0(args[1], "resource") == 0) {
|
} else if (g_strcmp0(args[1], "resource") == 0) {
|
||||||
cons_show("Roster resource disabled");
|
cons_show("Roster resource disabled");
|
||||||
prefs_set_boolean(PREF_ROSTER_RESOURCE, FALSE);
|
prefs_set_boolean(PREF_ROSTER_RESOURCE, FALSE);
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
@ -1581,17 +1598,23 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
if (g_strcmp0(args[1], "group") == 0) {
|
if (g_strcmp0(args[1], "group") == 0) {
|
||||||
cons_show("Grouping roster by roster group");
|
cons_show("Grouping roster by roster group");
|
||||||
prefs_set_string(PREF_ROSTER_BY, "group");
|
prefs_set_string(PREF_ROSTER_BY, "group");
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (g_strcmp0(args[1], "presence") == 0) {
|
} else if (g_strcmp0(args[1], "presence") == 0) {
|
||||||
cons_show("Grouping roster by presence");
|
cons_show("Grouping roster by presence");
|
||||||
prefs_set_string(PREF_ROSTER_BY, "presence");
|
prefs_set_string(PREF_ROSTER_BY, "presence");
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (g_strcmp0(args[1], "none") == 0) {
|
} else if (g_strcmp0(args[1], "none") == 0) {
|
||||||
cons_show("Roster grouping disabled");
|
cons_show("Roster grouping disabled");
|
||||||
prefs_set_string(PREF_ROSTER_BY, "none");
|
prefs_set_string(PREF_ROSTER_BY, "none");
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
@ -1599,6 +1622,10 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
}
|
}
|
||||||
// add contact
|
// add contact
|
||||||
} else if (strcmp(args[0], "add") == 0) {
|
} else if (strcmp(args[0], "add") == 0) {
|
||||||
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
|
cons_show("You are not currently connected.");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
char *jid = args[1];
|
char *jid = args[1];
|
||||||
if (jid == NULL) {
|
if (jid == NULL) {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
@ -1610,6 +1637,10 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
// remove contact
|
// remove contact
|
||||||
} else if (strcmp(args[0], "remove") == 0) {
|
} else if (strcmp(args[0], "remove") == 0) {
|
||||||
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
|
cons_show("You are not currently connected.");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
char *jid = args[1];
|
char *jid = args[1];
|
||||||
if (jid == NULL) {
|
if (jid == NULL) {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
@ -1620,6 +1651,10 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
// change nickname
|
// change nickname
|
||||||
} else if (strcmp(args[0], "nick") == 0) {
|
} else if (strcmp(args[0], "nick") == 0) {
|
||||||
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
|
cons_show("You are not currently connected.");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
char *jid = args[1];
|
char *jid = args[1];
|
||||||
if (jid == NULL) {
|
if (jid == NULL) {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
@ -1650,6 +1685,10 @@ cmd_roster(gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
// remove nickname
|
// remove nickname
|
||||||
} else if (strcmp(args[0], "clearnick") == 0) {
|
} else if (strcmp(args[0], "clearnick") == 0) {
|
||||||
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
|
cons_show("You are not currently connected.");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
char *jid = args[1];
|
char *jid = args[1];
|
||||||
if (jid == NULL) {
|
if (jid == NULL) {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
|
@ -123,12 +123,16 @@ _cleanup_dirs(void)
|
|||||||
void
|
void
|
||||||
prof_start(void)
|
prof_start(void)
|
||||||
{
|
{
|
||||||
fd = exp_spawnl("./profanity", "./profanity", "-l", "DEBUG", NULL);
|
// helper script sets terminal columns, avoids assertions failing
|
||||||
|
// based on the test runner terminal size
|
||||||
|
fd = exp_spawnl("sh",
|
||||||
|
"sh",
|
||||||
|
"-c",
|
||||||
|
"./tests/functionaltests/start_profanity.sh",
|
||||||
|
NULL);
|
||||||
FILE *fp = fdopen(fd, "r+");
|
FILE *fp = fdopen(fd, "r+");
|
||||||
|
|
||||||
if (fp == NULL) {
|
assert_true(fp != NULL);
|
||||||
assert_true(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
setbuf(fp, (char *)0);
|
setbuf(fp, (char *)0);
|
||||||
}
|
}
|
||||||
@ -155,15 +159,20 @@ init_prof_test(void **state)
|
|||||||
_create_logs_dir();
|
_create_logs_dir();
|
||||||
|
|
||||||
prof_start();
|
prof_start();
|
||||||
prof_output_exact("Profanity");
|
assert_true(prof_output_exact("Profanity"));
|
||||||
|
|
||||||
|
// set UI options to make expect assertions faster and more reliable
|
||||||
prof_input("/inpblock timeout 5");
|
prof_input("/inpblock timeout 5");
|
||||||
prof_output_exact("Input blocking set to 5 milliseconds");
|
assert_true(prof_output_exact("Input blocking set to 5 milliseconds"));
|
||||||
prof_input("/inpblock dynamic off");
|
prof_input("/inpblock dynamic off");
|
||||||
prof_output_exact("Dynamic input blocking disabled");
|
assert_true(prof_output_exact("Dynamic input blocking disabled"));
|
||||||
|
|
||||||
prof_input("/notify message off");
|
prof_input("/notify message off");
|
||||||
prof_output_exact("Message notifications disabled");
|
assert_true(prof_output_exact("Message notifications disabled"));
|
||||||
|
prof_input("/wrap off");
|
||||||
|
assert_true(prof_output_exact("Word wrap disabled"));
|
||||||
|
prof_input("/roster hide");
|
||||||
|
assert_true(prof_output_exact("Roster disabled"));
|
||||||
|
prof_input("/time off");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
2
tests/functionaltests/start_profanity.sh
Executable file
2
tests/functionaltests/start_profanity.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
export COLUMNS=300
|
||||||
|
./profanity -l DEBUG
|
@ -27,12 +27,12 @@ rooms_query(void **state)
|
|||||||
|
|
||||||
prof_input("/rooms");
|
prof_input("/rooms");
|
||||||
|
|
||||||
|
assert_true(prof_output_exact("chatroom@conference.localhost, (A chat room)"));
|
||||||
|
assert_true(prof_output_exact("hangout@conference.localhost, (Another chat room)"));
|
||||||
|
|
||||||
assert_true(stbbr_last_received(
|
assert_true(stbbr_last_received(
|
||||||
"<iq id=\"confreq\" to=\"conference.localhost\" type=\"get\">"
|
"<iq id=\"confreq\" to=\"conference.localhost\" type=\"get\">"
|
||||||
"<query xmlns=\"http://jabber.org/protocol/disco#items\"/>"
|
"<query xmlns=\"http://jabber.org/protocol/disco#items\"/>"
|
||||||
"</iq>"
|
"</iq>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("chatroom@conference.localhost, (A chat room)"));
|
|
||||||
assert_true(prof_output_exact("hangout@conference.localhost, (Another chat room)"));
|
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,13 @@
|
|||||||
static void test_with_connection_status(jabber_conn_status_t status)
|
static void test_with_connection_status(jabber_conn_status_t status)
|
||||||
{
|
{
|
||||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
|
gchar *args[] = { NULL };
|
||||||
|
|
||||||
will_return(jabber_get_connection_status, status);
|
will_return(jabber_get_connection_status, status);
|
||||||
|
|
||||||
expect_cons_show("You are not currently connected.");
|
expect_cons_show("You are not currently connected.");
|
||||||
|
|
||||||
gboolean result = cmd_roster(NULL, *help);
|
gboolean result = cmd_roster(args, *help);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
|
|
||||||
free(help);
|
free(help);
|
||||||
|
Loading…
Reference in New Issue
Block a user