Skip to content

Commit

Permalink
cleanup: Remove useless if clause
Browse files Browse the repository at this point in the history
  • Loading branch information
JFreegman committed Feb 28, 2024
1 parent d7f2101 commit f5e6dc3
Showing 1 changed file with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions toxcore/Messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -2469,48 +2469,45 @@ static void do_friends(Messenger *m, void *userdata)
}

if (m->friendlist[i].status == FRIEND_REQUESTED
|| m->friendlist[i].status == FRIEND_CONFIRMED) { /* friend is not online. */
if (m->friendlist[i].status == FRIEND_REQUESTED) {
/* If we didn't connect to friend after successfully sending him a friend request the request is deemed
* unsuccessful so we set the status back to FRIEND_ADDED and try again.
/* If we didn't connect to friend after successfully sending him a friend request the request
* is deemed unsuccessful so we set the status back to FRIEND_ADDED and try again.
*/
check_friend_request_timed_out(m, i, temp_time, userdata);
}

if (m->friendlist[i].status == FRIEND_ONLINE) { /* friend is online. */
if (!m->friendlist[i].name_sent) {
if (m_sendname(m, i, m->name, m->name_length)) {
m->friendlist[i].name_sent = true;
}
}

if (m->friendlist[i].status == FRIEND_ONLINE) { /* friend is online. */
if (!m->friendlist[i].name_sent) {
if (m_sendname(m, i, m->name, m->name_length)) {
m->friendlist[i].name_sent = true;
}
if (!m->friendlist[i].statusmessage_sent) {
if (send_statusmessage(m, i, m->statusmessage, m->statusmessage_length)) {
m->friendlist[i].statusmessage_sent = true;
}
}

if (!m->friendlist[i].statusmessage_sent) {
if (send_statusmessage(m, i, m->statusmessage, m->statusmessage_length)) {
m->friendlist[i].statusmessage_sent = true;
}
}

if (!m->friendlist[i].userstatus_sent) {
if (send_userstatus(m, i, m->userstatus)) {
m->friendlist[i].userstatus_sent = true;
}
if (!m->friendlist[i].userstatus_sent) {
if (send_userstatus(m, i, m->userstatus)) {
m->friendlist[i].userstatus_sent = true;
}
}

if (!m->friendlist[i].user_istyping_sent) {
if (send_user_istyping(m, i, m->friendlist[i].user_istyping)) {
m->friendlist[i].user_istyping_sent = true;
}
if (!m->friendlist[i].user_istyping_sent) {
if (send_user_istyping(m, i, m->friendlist[i].user_istyping)) {
m->friendlist[i].user_istyping_sent = true;
}
}

check_friend_tcp_udp(m, i, userdata);
do_receipts(m, i, userdata);
do_reqchunk_filecb(m, i, userdata);
check_friend_tcp_udp(m, i, userdata);
do_receipts(m, i, userdata);
do_reqchunk_filecb(m, i, userdata);

m->friendlist[i].last_seen_time = (uint64_t) time(nullptr);
}
m->friendlist[i].last_seen_time = (uint64_t) time(nullptr);
}
}
}

non_null(1) nullable(2)
static void m_connection_status_callback(Messenger *m, void *userdata)
Expand Down

0 comments on commit f5e6dc3

Please sign in to comment.