Skip to content

Commit

Permalink
Stop relying on arithmetics for call status notification
Browse files Browse the repository at this point in the history
  • Loading branch information
albel727 committed Sep 19, 2014
1 parent ad975de commit e0a010b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
18 changes: 17 additions & 1 deletion tox.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,23 @@ static void file_notify(FRIEND *f, MSG_FILE *msg)

static void call_notify(FRIEND *f, uint8_t status)
{
STRING *str = &strings[LANG][CALL_STRING_1 + (status & 3)];
STRING *str;

switch(status) {
case CALL_INVITED:
case CALL_INVITED_VIDEO:
str = SPTR(CALL_INVITED); break;
case CALL_RINGING:
case CALL_RINGING_VIDEO:
str = SPTR(CALL_RINGING); break;
case CALL_OK:
case CALL_OK_VIDEO:
str = SPTR(CALL_STARTED); break;
case CALL_NONE:
default: //render unknown status as "call cancelled"
str = SPTR(CALL_CANCELLED); break;
}

friend_notify(f, str->str, str->length, (uint8_t*)"", 0);
friend_addmessage_notify(f, str->str, str->length);
}
Expand Down
1 change: 0 additions & 1 deletion tox.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ enum
CALL_INVITED,
CALL_RINGING,
CALL_OK,
CALL_NONE_VIDEO, //not used
CALL_INVITED_VIDEO,
CALL_RINGING_VIDEO,
CALL_OK_VIDEO,
Expand Down
8 changes: 4 additions & 4 deletions ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ enum {
STR_TRANSFER_CANCELLED,
STR_TRANSFER_COMPLETE,

CALL_STRING_1,
CALL_STRING_2,
CALL_STRING_3,
CALL_STRING_4,
STR_CALL_CANCELLED,
STR_CALL_INVITED,
STR_CALL_RINGING,
STR_CALL_STARTED,

//REFERRED TO BY NAME
STR_ADDFRIENDS,
Expand Down

0 comments on commit e0a010b

Please sign in to comment.