本文整理汇总了Java中org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage类的典型用法代码示例。如果您正苦于以下问题:Java SignalServiceSyncMessage类的具体用法?Java SignalServiceSyncMessage怎么用?Java SignalServiceSyncMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SignalServiceSyncMessage类属于org.whispersystems.signalservice.api.messages.multidevice包,在下文中一共展示了SignalServiceSyncMessage类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onRun
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
@Override
public void onRun(MasterSecret masterSecret)
throws IOException, UntrustedIdentityException
{
RecipientPreferenceDatabase database = DatabaseFactory.getRecipientPreferenceDatabase(context);
SignalServiceMessageSender messageSender = messageSenderFactory.create();
BlockedReader reader = database.readerForBlocked(database.getBlocked());
List<String> blocked = new LinkedList<>();
Recipients recipients;
while ((recipients = reader.getNext()) != null) {
if (recipients.isSingleRecipient()) {
try {
blocked.add(Util.canonicalizeNumber(context, recipients.getPrimaryRecipient().getNumber()));
} catch (InvalidNumberException e) {
Log.w(TAG, e);
}
}
}
messageSender.sendMessage(SignalServiceSyncMessage.forBlocked(new BlockedListMessage(blocked)));
}
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:24,代码来源:MultiDeviceBlockedUpdateJob.java
示例2: sendUpdate
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
private void sendUpdate(SignalServiceMessageSender messageSender, File contactsFile)
throws IOException, UntrustedIdentityException, NetworkException
{
if (contactsFile.length() > 0) {
FileInputStream contactsFileStream = new FileInputStream(contactsFile);
SignalServiceAttachmentStream attachmentStream = SignalServiceAttachment.newStreamBuilder()
.withStream(contactsFileStream)
.withContentType("application/octet-stream")
.withLength(contactsFile.length())
.build();
try {
messageSender.sendMessage(SignalServiceSyncMessage.forContacts(attachmentStream));
} catch (IOException ioe) {
throw new NetworkException(ioe);
}
}
}
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:19,代码来源:MultiDeviceContactUpdateJob.java
示例3: onRun
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
@Override
public void onRun(MasterSecret masterSecret) throws IOException, UntrustedIdentityException {
if (!TextSecurePreferences.isMultiDevice(context)) {
Log.w(TAG, "Not multi device...");
return;
}
List<ReadMessage> readMessages = new LinkedList<>();
for (SerializableSyncMessageId messageId : messageIds) {
readMessages.add(new ReadMessage(messageId.sender, messageId.timestamp));
}
SignalServiceMessageSender messageSender = messageSenderFactory.create();
messageSender.sendMessage(SignalServiceSyncMessage.forRead(readMessages));
}
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:17,代码来源:MultiDeviceReadUpdateJob.java
示例4: sendMessage
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
public void sendMessage(SignalServiceSyncMessage message)
throws IOException, UntrustedIdentityException
{
byte[] content;
if (message.getContacts().isPresent()) {
content = createMultiDeviceContactsContent(message.getContacts().get().asStream());
} else if (message.getGroups().isPresent()) {
content = createMultiDeviceGroupsContent(message.getGroups().get().asStream());
} else if (message.getRead().isPresent()) {
content = createMultiDeviceReadContent(message.getRead().get());
} else if (message.getBlockedList().isPresent()) {
content = createMultiDeviceBlockedContent(message.getBlockedList().get());
} else {
throw new IOException("Unsupported sync message!");
}
sendMessage(localAddress, System.currentTimeMillis(), content, false, false);
}
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:20,代码来源:SignalServiceMessageSender.java
示例5: createSynchronizeMessage
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
private SignalServiceSyncMessage createSynchronizeMessage(SignalServiceEnvelope envelope, SyncMessage content) {
if (content.hasSent()) {
SyncMessage.Sent sentContent = content.getSent();
return SignalServiceSyncMessage.forSentTranscript(new SentTranscriptMessage(sentContent.getDestination(),
sentContent.getTimestamp(),
createSignalServiceMessage(envelope, sentContent.getMessage()),
sentContent.getExpirationStartTimestamp()));
}
if (content.hasRequest()) {
return SignalServiceSyncMessage.forRequest(new RequestMessage(content.getRequest()));
}
if (content.getReadList().size() > 0) {
List<ReadMessage> readMessages = new LinkedList<>();
for (SyncMessage.Read read : content.getReadList()) {
readMessages.add(new ReadMessage(read.getSender(), read.getTimestamp()));
}
return SignalServiceSyncMessage.forRead(readMessages);
}
return SignalServiceSyncMessage.empty();
}
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:26,代码来源:SignalServiceCipher.java
示例6: onRun
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
@Override
public void onRun() throws IOException, UntrustedIdentityException {
try {
if (!TextSecurePreferences.isMultiDevice(context)) {
Log.w(TAG, "Not multi device...");
return;
}
if (destination == null) {
Log.w(TAG, "No destination...");
return;
}
String canonicalDestination = Util.canonicalizeNumber(context, destination);
VerifiedMessage.VerifiedState verifiedState = getVerifiedState(verifiedStatus);
SignalServiceMessageSender messageSender = messageSenderFactory.create();
VerifiedMessage verifiedMessage = new VerifiedMessage(canonicalDestination, new IdentityKey(identityKey, 0), verifiedState, timestamp);
messageSender.sendMessage(SignalServiceSyncMessage.forVerified(verifiedMessage));
} catch (InvalidNumberException | InvalidKeyException e) {
throw new IOException(e);
}
}
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:MultiDeviceVerifiedUpdateJob.java
示例7: sendUpdate
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
private void sendUpdate(SignalServiceMessageSender messageSender, File contactsFile, boolean complete)
throws IOException, UntrustedIdentityException, NetworkException
{
if (contactsFile.length() > 0) {
FileInputStream contactsFileStream = new FileInputStream(contactsFile);
SignalServiceAttachmentStream attachmentStream = SignalServiceAttachment.newStreamBuilder()
.withStream(contactsFileStream)
.withContentType("application/octet-stream")
.withLength(contactsFile.length())
.build();
try {
messageSender.sendMessage(SignalServiceSyncMessage.forContacts(new ContactsMessage(attachmentStream, complete)));
} catch (IOException ioe) {
throw new NetworkException(ioe);
}
}
}
开发者ID:CableIM,项目名称:Cable-Android,代码行数:19,代码来源:MultiDeviceContactUpdateJob.java
示例8: sendUpdate
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
private void sendUpdate(SignalServiceMessageSender messageSender, File contactsFile)
throws IOException, UntrustedIdentityException
{
FileInputStream contactsFileStream = new FileInputStream(contactsFile);
SignalServiceAttachmentStream attachmentStream = SignalServiceAttachment.newStreamBuilder()
.withStream(contactsFileStream)
.withContentType("application/octet-stream")
.withLength(contactsFile.length())
.build();
messageSender.sendMessage(SignalServiceSyncMessage.forGroups(attachmentStream));
}
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:13,代码来源:MultiDeviceGroupUpdateJob.java
示例9: markRead
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
/**
* Notify other devices that these messages have been read.
* @param messages
* @throws IOException
*/
public void markRead(List<ReadMessage> messages) throws IOException {
checkRegistered();
checkMessageSender();
try {
SignalServiceSyncMessage syncMessage = SignalServiceSyncMessage.forRead(messages);
messageSender.sendMessage(syncMessage);
} catch (UntrustedIdentityException e) {
fireSecurityException(new SignalServiceAddress(store.getPhoneNumber()), e);
}
}
开发者ID:Turakar,项目名称:signal4j,代码行数:16,代码来源:SignalService.java
示例10: requestSync
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
/**
* Request sync messages from primary device. They are received using the listeners
* @throws IOException
* @throws UntrustedIdentityException
*/
public void requestSync() throws IOException {
try {
checkRegistered();
checkMessageSender();
Request.Type[] types = new Request.Type[] {Request.Type.CONTACTS, Request.Type.GROUPS, Request.Type.BLOCKED};
for(Request.Type type : types) {
RequestMessage request = new RequestMessage(Request.newBuilder().setType(type).build());
SignalServiceSyncMessage syncMessage = SignalServiceSyncMessage.forRequest(request);
messageSender.sendMessage(syncMessage);
}
} catch(UntrustedIdentityException e) {
fireSecurityException(new SignalServiceAddress(store.getPhoneNumber()), e);
}
}
开发者ID:Turakar,项目名称:signal4j,代码行数:20,代码来源:SignalService.java
示例11: JsonSyncMessage
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
JsonSyncMessage(SignalServiceSyncMessage syncMessage) {
if (syncMessage.getSent().isPresent()) {
this.sentMessage = new JsonDataMessage(syncMessage.getSent().get().getMessage());
}
if (syncMessage.getBlockedList().isPresent()) {
this.blockedNumbers = syncMessage.getBlockedList().get().getNumbers();
}
if (syncMessage.getRead().isPresent()) {
this.readMessages = syncMessage.getRead().get();
}
}
开发者ID:AsamK,项目名称:signal-cli,代码行数:12,代码来源:JsonSyncMessage.java
示例12: SignalServiceContent
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
public SignalServiceContent(SignalServiceSyncMessage synchronizeMessage) {
this.message = Optional.absent();
this.synchronizeMessage = Optional.fromNullable(synchronizeMessage);
this.callMessage = Optional.absent();
}
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:6,代码来源:SignalServiceContent.java
示例13: getSyncMessage
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; //导入依赖的package包/类
public Optional<SignalServiceSyncMessage> getSyncMessage() {
return synchronizeMessage;
}
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:4,代码来源:SignalServiceContent.java
注:本文中的org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论