/** * Construct a TextSecureMessage.s * * @param timestamp The sent timestamp. * @param group The group information (or null if none). * @param attachments The attachments (or null if none). * @param body The message contents. * @param endSession Flag indicating whether this message should close a session. */ public TextSecureDataMessage(ulong timestamp, TextSecureGroup group, LinkedList <TextSecureAttachment> attachments, String body, bool endSession) { this.timestamp = timestamp; this.body = new May <String>(body); this.group = group == null ? May <TextSecureGroup> .NoValue : new May <TextSecureGroup>(group); //this.syncContext = syncContext == null ? May<TextSecureSyncContext>.NoValue : new May<TextSecureSyncContext>(syncContext); this.endSession = endSession; if (attachments != null && !(attachments.Count == 0)) { this.attachments = new May <LinkedList <TextSecureAttachment> >(attachments); } else { this.attachments = May <LinkedList <TextSecureAttachment> > .NoValue; } }
private GroupContext createGroupContent(TextSecureGroup group) { GroupContext.Builder builder = GroupContext.CreateBuilder(); builder.SetId(ByteString.CopyFrom(group.getGroupId())); if (group.getType() != TextSecureGroup.Type.DELIVER) { if (group.getType() == TextSecureGroup.Type.UPDATE) builder.SetType(GroupContext.Types.Type.UPDATE); else if (group.getType() == TextSecureGroup.Type.QUIT) builder.SetType(GroupContext.Types.Type.QUIT); else throw new Exception("Unknown type: " + group.getType()); if (group.getName().HasValue) builder.SetName(group.getName().ForceGetValue()); if (group.getMembers().HasValue) builder.AddRangeMembers(group.getMembers().ForceGetValue()); if (group.getAvatar().HasValue && group.getAvatar().ForceGetValue().isStream()) { AttachmentPointer pointer = createAttachmentPointer(group.getAvatar().ForceGetValue().asStream()); builder.SetAvatar(pointer); } } else { builder.SetType(GroupContext.Types.Type.DELIVER); } return builder.Build(); }
/** * Construct a TextSecure group message with attachments and body. * * @param timestamp The sent timestamp. * @param group The group information. * @param attachments The attachments. * @param body The message contents. */ public TextSecureDataMessage(ulong timestamp, TextSecureGroup group, LinkedList <TextSecureAttachment> attachments, String body) : this(timestamp, group, attachments, body, false) { }
public TextSecureDataMessageBuilder asGroupMessage(TextSecureGroup group) { this.group = group; return(this); }
/** * Construct a TextSecureMessage.s * * @param timestamp The sent timestamp. * @param group The group information (or null if none). * @param attachments The attachments (or null if none). * @param body The message contents. * @param endSession Flag indicating whether this message should close a session. */ public TextSecureDataMessage(ulong timestamp, TextSecureGroup group, LinkedList<TextSecureAttachment> attachments, String body, bool endSession) { this.timestamp = timestamp; this.body = new May<String>(body); this.group = group == null ? May<TextSecureGroup>.NoValue : new May<TextSecureGroup>(group); //this.syncContext = syncContext == null ? May<TextSecureSyncContext>.NoValue : new May<TextSecureSyncContext>(syncContext); this.endSession = endSession; if (attachments != null && !(attachments.Count == 0)) { this.attachments = new May<LinkedList<TextSecureAttachment>>(attachments); } else { this.attachments = May<LinkedList<TextSecureAttachment>>.NoValue; } }
/** * Construct a TextSecure group message with attachments and body. * * @param timestamp The sent timestamp. * @param group The group information. * @param attachments The attachments. * @param body The message contents. */ public TextSecureDataMessage(ulong timestamp, TextSecureGroup group, LinkedList<TextSecureAttachment> attachments, String body) : this(timestamp, group, attachments, body, false) { }
public TextSecureDataMessageBuilder asGroupMessage(TextSecureGroup group) { this.group = group; return this; }