mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
nodejs: add composing indicators
Change-Id: I3a1109e0acc64aed296abe19a198d71253cd4364
This commit is contained in:
@ -12,6 +12,7 @@ using namespace v8;
|
||||
Persistent<Function> accountsChangedCb;
|
||||
Persistent<Function> accountDetailsChangedCb;
|
||||
Persistent<Function> registrationStateChangedCb;
|
||||
Persistent<Function> composingStatusChangedCb;
|
||||
Persistent<Function> volatileDetailsChangedCb;
|
||||
Persistent<Function> incomingAccountMessageCb;
|
||||
Persistent<Function> accountMessageStatusChangedCb;
|
||||
@ -56,6 +57,8 @@ getPresistentCb(std::string_view signal)
|
||||
return &accountDetailsChangedCb;
|
||||
else if (signal == "RegistrationStateChanged")
|
||||
return ®istrationStateChangedCb;
|
||||
else if (signal == "ComposingStatusChanged")
|
||||
return &composingStatusChangedCb;
|
||||
else if (signal == "VolatileDetailsChanged")
|
||||
return &volatileDetailsChangedCb;
|
||||
else if (signal == "IncomingAccountMessage")
|
||||
@ -226,6 +229,28 @@ registrationStateChanged(const std::string& accountId,
|
||||
uv_async_send(&signalAsync);
|
||||
}
|
||||
|
||||
void
|
||||
composingStatusChanged(const std::string& accountId,
|
||||
const std::string& conversationId,
|
||||
const std::string& from,
|
||||
int state)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(pendingSignalsLock);
|
||||
pendingSignals.emplace([accountId, conversationId, from, state]() {
|
||||
Local<Function> func = Local<Function>::New(Isolate::GetCurrent(),
|
||||
composingStatusChangedCb);
|
||||
if (!func.IsEmpty()) {
|
||||
SWIGV8_VALUE callback_args[] = {V8_STRING_NEW_LOCAL(accountId),
|
||||
V8_STRING_NEW_LOCAL(conversationId),
|
||||
V8_STRING_NEW_LOCAL(from),
|
||||
SWIGV8_INTEGER_NEW(state)};
|
||||
func->Call(SWIGV8_CURRENT_CONTEXT(), SWIGV8_NULL(), 4, callback_args);
|
||||
}
|
||||
});
|
||||
|
||||
uv_async_send(&signalAsync);
|
||||
}
|
||||
|
||||
void
|
||||
volatileDetailsChanged(const std::string& accountId,
|
||||
const std::map<std::string, std::string>& details)
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
virtual void incomingAccountMessage(const std::string& /*account_id*/, const std::string& /*from*/, const std::map<std::string, std::string>& /*payload*/){}
|
||||
virtual void accountMessageStatusChanged(const std::string& /*account_id*/, const std::string& /*conversationId*/, const std::string& /*peer*/, const std::string& /*message_id*/, int /*state*/){}
|
||||
virtual void profileReceived(const std::string& /*account_id*/, const std::string& /*from*/, const std::string& /*path*/){}
|
||||
virtual void composingStatusChanged(const std::string& /*account_id*/, const std::string& /*convId*/, const std::string& /*from*/, int /*state*/){}
|
||||
virtual void knownDevicesChanged(const std::string& /*account_id*/, const std::map<std::string, std::string>& /*devices*/){}
|
||||
virtual void exportOnRingEnded(const std::string& /*account_id*/, int /*state*/, const std::string& /*pin*/){}
|
||||
|
||||
@ -91,6 +92,7 @@ std::vector<Message> getLastMessages(const std::string& accountID, const uint64_
|
||||
int getMessageStatus(uint64_t id);
|
||||
int getMessageStatus(const std::string& accountID, uint64_t id);
|
||||
bool cancelMessage(const std::string& accountID, uint64_t id);
|
||||
void setIsComposing(const std::string& accountID, const std::string& conversationUri, bool isWriting);
|
||||
bool setMessageDisplayed(const std::string& accountID, const std::string& conversationUri, const std::string& messageId, int status);
|
||||
bool lookupName(const std::string& account, const std::string& nameserver, const std::string& name);
|
||||
bool lookupAddress(const std::string& account, const std::string& nameserver, const std::string& address);
|
||||
@ -231,6 +233,7 @@ public:
|
||||
virtual void incomingAccountMessage(const std::string& /*account_id*/, const std::string& /*from*/, const std::map<std::string, std::string>& /*payload*/){}
|
||||
virtual void accountMessageStatusChanged(const std::string& /*account_id*/, const std::string& /*conversationId*/, const std::string& /*peer*/, const std::string& /*message_id*/, int /*state*/){}
|
||||
virtual void profileReceived(const std::string& /*account_id*/, const std::string& /*from*/, const std::string& /*path*/){}
|
||||
virtual void composingStatusChanged(const std::string& /*account_id*/, const std::string& /*convId*/, const std::string& /*from*/, int /*state*/){}
|
||||
virtual void knownDevicesChanged(const std::string& /*account_id*/, const std::map<std::string, std::string>& /*devices*/){}
|
||||
virtual void exportOnRingEnded(const std::string& /*account_id*/, int /*state*/, const std::string& /*pin*/){}
|
||||
|
||||
|
@ -131,6 +131,7 @@ void init(const SWIGV8_VALUE& funcMap){
|
||||
exportable_callback<ConfigurationSignal::AccountsChanged>(bind(&accountsChanged)),
|
||||
exportable_callback<ConfigurationSignal::AccountDetailsChanged>(bind(&accountDetailsChanged, _1, _2)),
|
||||
exportable_callback<ConfigurationSignal::RegistrationStateChanged>(bind(®istrationStateChanged, _1, _2, _3, _4)),
|
||||
exportable_callback<ConfigurationSignal::ComposingStatusChanged>(bind(composingStatusChanged, _1, _2, _3, _4 )),
|
||||
exportable_callback<ConfigurationSignal::ContactAdded>(bind(&contactAdded, _1, _2, _3 )),
|
||||
exportable_callback<ConfigurationSignal::ContactRemoved>(bind(&contactRemoved, _1, _2, _3 )),
|
||||
exportable_callback<ConfigurationSignal::ExportOnRingEnded>(bind(&exportOnRingEnded, _1, _2, _3 )),
|
||||
|
Reference in New Issue
Block a user