mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Typing and status functions implemented.
This commit is contained in:
parent
308cf5da6d
commit
c037aefe9d
|
@ -806,7 +806,7 @@ int m_set_usertyping(Messenger *m, int32_t friendnumber, uint8_t is_typing)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t m_get_istyping(const Messenger *m, int32_t friendnumber)
|
int m_get_istyping(const Messenger *m, int32_t friendnumber)
|
||||||
{
|
{
|
||||||
if (friend_not_valid(m, friendnumber))
|
if (friend_not_valid(m, friendnumber))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -616,7 +616,7 @@ int m_set_usertyping(Messenger *m, int32_t friendnumber, uint8_t is_typing);
|
||||||
* returns 0 if friend is not typing.
|
* returns 0 if friend is not typing.
|
||||||
* returns 1 if friend is typing.
|
* returns 1 if friend is typing.
|
||||||
*/
|
*/
|
||||||
uint8_t m_get_istyping(const Messenger *m, int32_t friendnumber);
|
int m_get_istyping(const Messenger *m, int32_t friendnumber);
|
||||||
|
|
||||||
/* Sets whether we send read receipts for friendnumber.
|
/* Sets whether we send read receipts for friendnumber.
|
||||||
* This function is not lazy, and it will fail if yesno is not (0 or 1).
|
* This function is not lazy, and it will fail if yesno is not (0 or 1).
|
||||||
|
|
|
@ -646,3 +646,43 @@ void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *
|
||||||
Messenger *m = tox;
|
Messenger *m = tox;
|
||||||
m_callback_statusmessage(m, function, user_data);
|
m_callback_statusmessage(m, function, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TOX_STATUS tox_friend_get_status(Tox const *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
|
||||||
|
{
|
||||||
|
const Messenger *m = tox;
|
||||||
|
|
||||||
|
int ret = m_get_userstatus(m, friend_number);
|
||||||
|
|
||||||
|
if (ret == USERSTATUS_INVALID) {
|
||||||
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_FRIEND_NOT_FOUND);
|
||||||
|
return TOX_STATUS_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_OK);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tox_callback_friend_status(Tox *tox, tox_friend_status_cb *function, void *user_data)
|
||||||
|
{
|
||||||
|
Messenger *m = tox;
|
||||||
|
m_callback_userstatus(m, function, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tox_friend_get_typing(Tox const *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
|
||||||
|
{
|
||||||
|
const Messenger *m = tox;
|
||||||
|
int ret = m_get_istyping(m, friend_number);
|
||||||
|
if (ret == -1) {
|
||||||
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_FRIEND_NOT_FOUND);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_OK);
|
||||||
|
return !!ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tox_callback_friend_typing(Tox *tox, tox_friend_typing_cb *function, void *user_data)
|
||||||
|
{
|
||||||
|
Messenger *m = tox;
|
||||||
|
m_callback_typingchange(m, function, user_data);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user