Output message read offsets in conversation list

This commit is contained in:
Jeremy Lakeman 2013-07-30 16:26:01 +09:30
parent 88c986ebb5
commit e4882f175b
2 changed files with 15 additions and 15 deletions

View File

@ -614,7 +614,9 @@ static int output_conversations(struct cli_context *context, struct conversation
if (output + traverse_count >= offset){
cli_put_long(context, output + traverse_count, ":");
cli_put_hexvalue(context, conv->them.binary, sizeof(conv->them), ":");
cli_put_string(context, conv->read_offset < conv->their_last_message ? "unread":"", "\n");
cli_put_string(context, conv->read_offset < conv->their_last_message ? "unread":"", ":");
cli_put_long(context, conv->their_last_message, ":");
cli_put_long(context, conv->read_offset, "\n");
}
traverse_count++;
}
@ -648,10 +650,10 @@ int app_meshms_conversations(const struct cli_parsed *parsed, struct cli_context
return -1;
const char *names[]={
"_id","recipient","read"
"_id","recipient","read", "last_message", "read_offset"
};
cli_columns(context, 3, names);
cli_columns(context, 5, names);
int rows = output_conversations(context, conv, 0, offset, count);
cli_row_count(context, rows);

View File

@ -94,7 +94,7 @@ setup_MessageThreading() {
has_unread_messages() {
executeOk_servald meshms list conversations $1
if ! grep ":unread\$" $_tfw_tmp/stdout; then
if ! grep ":unread:" $_tfw_tmp/stdout; then
return 1
fi
}
@ -144,12 +144,12 @@ setup_listConversations() {
}
test_listConversations() {
executeOk_servald meshms list conversations $SIDA1
tfw_cat --stderr
assertStdoutIs --stderr --line=1 -e '3\n'
assertStdoutIs --stderr --line=2 -e '_id:recipient:read\n'
assertStdoutGrep --stderr --matches=1 ":$SIDA2:\$"
assertStdoutGrep --stderr --matches=1 ":$SIDA3:unread\$"
assertStdoutGrep --stderr --matches=1 ":$SIDA4:unread\$"
tfw_cat --stdout
assertStdoutIs --stderr --line=1 -e '5\n'
assertStdoutIs --stderr --line=2 -e '_id:recipient:read:last_message:read_offset\n'
assertStdoutGrep --stderr --matches=1 ":$SIDA2::0:0\$"
assertStdoutGrep --stderr --matches=1 ":$SIDA3:unread:11:0\$"
assertStdoutGrep --stderr --matches=1 ":$SIDA4:unread:14:0\$"
assertStdoutLineCount '==' 5
executeOk_servald meshms list conversations $SIDA1 1
tfw_cat --stderr
@ -161,11 +161,9 @@ test_listConversations() {
executeOk_servald meshms read messages $SIDA1
tfw_cat --stderr
executeOk_servald meshms list conversations $SIDA1
assertStdoutIs --stderr --line=1 -e '3\n'
assertStdoutIs --stderr --line=2 -e '_id:recipient:read\n'
assertStdoutGrep --stderr --matches=1 ":$SIDA2:\$"
assertStdoutGrep --stderr --matches=1 ":$SIDA3:\$"
assertStdoutGrep --stderr --matches=1 ":$SIDA4:\$"
assertStdoutGrep --stderr --matches=1 ":$SIDA2::0:0\$"
assertStdoutGrep --stderr --matches=1 ":$SIDA3::11:11\$"
assertStdoutGrep --stderr --matches=1 ":$SIDA4::14:14\$"
assertStdoutLineCount '==' 5
}