Support for group sync
Protocol and handling is all analogous to contact sync: Multiple GroupDetails structs are packed into a single attachment blob and parsed on our end. We don't display the synced groups in the conversation list until a new message is sent to one of them. // FREEBIE
This commit is contained in:
parent
3dd8056487
commit
5925c2fe84
9 changed files with 246 additions and 69 deletions
|
@ -49,28 +49,29 @@
|
|||
window.addEventListener('group', onGroupReceived);
|
||||
window.addEventListener('sent', onSentMessage);
|
||||
window.addEventListener('error', onError);
|
||||
|
||||
// initialize the socket and start listening for messages
|
||||
messageReceiver = new textsecure.MessageReceiver(window);
|
||||
}
|
||||
|
||||
function onContactReceived(ev) {
|
||||
var contactInfo = ev.contactInfo;
|
||||
var contactDetails = ev.contactDetails;
|
||||
new Whisper.Conversation({
|
||||
name: contactInfo.name,
|
||||
id: contactInfo.number,
|
||||
avatar: contactInfo.avatar,
|
||||
name: contactDetails.name,
|
||||
id: contactDetails.number,
|
||||
avatar: contactDetails.avatar,
|
||||
type: 'private',
|
||||
active_at: null
|
||||
}).save();
|
||||
}
|
||||
|
||||
function onGroupReceived(ev) {
|
||||
var group = ev.group;
|
||||
var groupDetails = ev.groupDetails;
|
||||
new Whisper.Conversation({
|
||||
members: group.members,
|
||||
name: group.name,
|
||||
id: group.id,
|
||||
avatar: group.avatar,
|
||||
id: groupDetails.id,
|
||||
name: groupDetails.name,
|
||||
members: groupDetails.members,
|
||||
avatar: groupDetails.avatar,
|
||||
type: 'group',
|
||||
active_at: null
|
||||
}).save();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue