Removed friendstatus from client API

This commit is contained in:
Maxim Biro 2013-09-07 16:05:16 -04:00
parent eeec99723c
commit f5bf852400
4 changed files with 55 additions and 37 deletions

View File

@ -275,18 +275,20 @@ int m_delfriend(Messenger *m, int friendnumber)
return 0;
}
/* return FRIEND_ONLINE if friend is online.
* return FRIEND_CONFIRMED if friend is confirmed.
* return FRIEND_REQUESTED if the friend request was sent.
* return FRIEND_ADDED if the friend was added.
* return NOFRIEND if there is no friend with that number.
*/
int m_friendstatus(Messenger *m, int friendnumber)
int m_get_friend_connectionstatus(Messenger *m, int friendnumber)
{
if (friend_not_valid(m, friendnumber))
return NOFRIEND;
return -1;
return m->friendlist[friendnumber].status;
return m->friendlist[friendnumber].status == FRIEND_ONLINE;
}
int m_friend_exists(Messenger *m, int friendnumber)
{
if (friend_not_valid(m, friendnumber))
return 0;
return m->friendlist[friendnumber].status > NOFRIEND;
}
/* Send a text chat message to an online friend.

View File

@ -202,13 +202,20 @@ int getclient_id(Messenger *m, int friend_id, uint8_t *client_id);
/* Remove a friend. */
int m_delfriend(Messenger *m, int friendnumber);
/* return 4 if friend is online.
* return 3 if friend is confirmed.
* return 2 if the friend request was sent.
* return 1 if the friend was added.
* return 0 if there is no friend with that number.
/* Checks friend's connecting status.
*
* return 1 if friend is connected to us (Online).
* return 0 if friend is not connected to us (Offline).
* return -1 on failure.
*/
int m_friendstatus(Messenger *m, int friendnumber);
int m_get_friend_connectionstatus(Messenger *m, int friendnumber);
/* Checks if there exists a friend with given friendnumber.
*
* return 1 if friend exists.
* return 0 if friend doesn't exist.
*/
int m_friend_exists(Messenger *m, int friendnumber);
/* Send a text chat message to an online friend.
*

View File

@ -99,16 +99,27 @@ int tox_delfriend(void *tox, int friendnumber)
return m_delfriend(m, friendnumber);
}
/* return 4 if friend is online.
* return 3 if friend is confirmed.
* return 2 if the friend request was sent.
* return 1 if the friend was added.
* return 0 if there is no friend with that number.
/* Checks friend's connecting status.
*
* return 1 if friend is connected to us (Online).
* return 0 if friend is not connected to us (Offline).
* return -1 on failure.
*/
int tox_friendstatus(void *tox, int friendnumber)
int tox_get_friend_connectionstatus(void *tox, int friendnumber)
{
Messenger *m = tox;
return m_friendstatus(m, friendnumber);
return m_get_friend_connectionstatus(m, friendnumber);
}
/* Checks if there exists a friend with given friendnumber.
*
* return 1 if friend exists.
* return 0 if friend doesn't exist.
*/
int tox_friend_exists(void *tox, int friendnumber)
{
Messenger *m = tox;
return m_friend_exists(m, friendnumber);
}
/* Send a text chat message to an online friend.

View File

@ -50,15 +50,6 @@ typedef struct {
uint16_t padding;
} tox_IP_Port;
/* Status definitions. */
enum {
TOX_NOFRIEND,
TOX_FRIEND_ADDED,
TOX_FRIEND_REQUESTED,
TOX_FRIEND_CONFIRMED,
TOX_FRIEND_ONLINE,
};
/* Errors for m_addfriend
* FAERR - Friend Add Error
*/
@ -130,13 +121,20 @@ int tox_getclient_id(Tox *tox, int friend_id, uint8_t *client_id);
/* Remove a friend. */
int tox_delfriend(Tox *tox, int friendnumber);
/* return TOX_FRIEND_ONLINE if friend is online.
* return TOX_FRIEND_CONFIRMED if friend is confirmed.
* return TOX_FRIEND_REQUESTED if the friend request was sent.
* return TOX_FRIEND_ADDED if the friend was added.
* return TOX_NOFRIEND if there is no friend with that number.
/* Checks friend's connecting status.
*
* return 1 if friend is connected to us (Online).
* return 0 if friend is not connected to us (Offline).
* return -1 on failure.
*/
int tox_friendstatus(Tox *tox, int friendnumber);
int tox_get_friend_connectionstatus(Tox *tox, int friendnumber);
/* Checks if there exists a friend with given friendnumber.
*
* return 1 if friend exists.
* return 0 if friend doesn't exist.
*/
int tox_friend_exists(Tox *tox, int friendnumber);
/* Send a text chat message to an online friend.
*