Update protobuf

pull/355/head
nielsandriesse 4 years ago
parent e2ce5bf58a
commit 268971af9a

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,9 +1,10 @@
// DO NOT EDIT. // DO NOT EDIT.
// swift-format-ignore-file
// //
// Generated by the Swift generator plugin for the protocol buffer compiler. // Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: WebSocketResources.proto // Source: WebSocketResources.proto
// //
// For information on using the generated types, please see the documenation: // For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/ // https://github.com/apple/swift-protobuf/
//* //*
@ -20,7 +21,7 @@ import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file // If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is // was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking. // incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that your are building against the same version of the API // Please ensure that you are building against the same version of the API
// that was used to generate this file. // that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
@ -145,31 +146,31 @@ struct WebSocketProtos_WebSocketMessage {
/// @required /// @required
var type: WebSocketProtos_WebSocketMessage.TypeEnum { var type: WebSocketProtos_WebSocketMessage.TypeEnum {
get {return _storage._type ?? .unknown} get {return _type ?? .unknown}
set {_uniqueStorage()._type = newValue} set {_type = newValue}
} }
/// Returns true if `type` has been explicitly set. /// Returns true if `type` has been explicitly set.
var hasType: Bool {return _storage._type != nil} var hasType: Bool {return self._type != nil}
/// Clears the value of `type`. Subsequent reads from it will return its default value. /// Clears the value of `type`. Subsequent reads from it will return its default value.
mutating func clearType() {_uniqueStorage()._type = nil} mutating func clearType() {self._type = nil}
var request: WebSocketProtos_WebSocketRequestMessage { var request: WebSocketProtos_WebSocketRequestMessage {
get {return _storage._request ?? WebSocketProtos_WebSocketRequestMessage()} get {return _request ?? WebSocketProtos_WebSocketRequestMessage()}
set {_uniqueStorage()._request = newValue} set {_request = newValue}
} }
/// Returns true if `request` has been explicitly set. /// Returns true if `request` has been explicitly set.
var hasRequest: Bool {return _storage._request != nil} var hasRequest: Bool {return self._request != nil}
/// Clears the value of `request`. Subsequent reads from it will return its default value. /// Clears the value of `request`. Subsequent reads from it will return its default value.
mutating func clearRequest() {_uniqueStorage()._request = nil} mutating func clearRequest() {self._request = nil}
var response: WebSocketProtos_WebSocketResponseMessage { var response: WebSocketProtos_WebSocketResponseMessage {
get {return _storage._response ?? WebSocketProtos_WebSocketResponseMessage()} get {return _response ?? WebSocketProtos_WebSocketResponseMessage()}
set {_uniqueStorage()._response = newValue} set {_response = newValue}
} }
/// Returns true if `response` has been explicitly set. /// Returns true if `response` has been explicitly set.
var hasResponse: Bool {return _storage._response != nil} var hasResponse: Bool {return self._response != nil}
/// Clears the value of `response`. Subsequent reads from it will return its default value. /// Clears the value of `response`. Subsequent reads from it will return its default value.
mutating func clearResponse() {_uniqueStorage()._response = nil} mutating func clearResponse() {self._response = nil}
var unknownFields = SwiftProtobuf.UnknownStorage() var unknownFields = SwiftProtobuf.UnknownStorage()
@ -204,7 +205,9 @@ struct WebSocketProtos_WebSocketMessage {
init() {} init() {}
fileprivate var _storage = _StorageClass.defaultInstance fileprivate var _type: WebSocketProtos_WebSocketMessage.TypeEnum? = nil
fileprivate var _request: WebSocketProtos_WebSocketRequestMessage? = nil
fileprivate var _response: WebSocketProtos_WebSocketResponseMessage? = nil
} }
#if swift(>=4.2) #if swift(>=4.2)
@ -333,70 +336,34 @@ extension WebSocketProtos_WebSocketMessage: SwiftProtobuf.Message, SwiftProtobuf
3: .same(proto: "response"), 3: .same(proto: "response"),
] ]
fileprivate class _StorageClass {
var _type: WebSocketProtos_WebSocketMessage.TypeEnum? = nil
var _request: WebSocketProtos_WebSocketRequestMessage? = nil
var _response: WebSocketProtos_WebSocketResponseMessage? = nil
static let defaultInstance = _StorageClass()
private init() {}
init(copying source: _StorageClass) {
_type = source._type
_request = source._request
_response = source._response
}
}
fileprivate mutating func _uniqueStorage() -> _StorageClass {
if !isKnownUniquelyReferenced(&_storage) {
_storage = _StorageClass(copying: _storage)
}
return _storage
}
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
_ = _uniqueStorage() while let fieldNumber = try decoder.nextFieldNumber() {
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in switch fieldNumber {
while let fieldNumber = try decoder.nextFieldNumber() { case 1: try decoder.decodeSingularEnumField(value: &self._type)
switch fieldNumber { case 2: try decoder.decodeSingularMessageField(value: &self._request)
case 1: try decoder.decodeSingularEnumField(value: &_storage._type) case 3: try decoder.decodeSingularMessageField(value: &self._response)
case 2: try decoder.decodeSingularMessageField(value: &_storage._request) default: break
case 3: try decoder.decodeSingularMessageField(value: &_storage._response)
default: break
}
} }
} }
} }
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in if let v = self._type {
if let v = _storage._type { try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
try visitor.visitSingularEnumField(value: v, fieldNumber: 1) }
} if let v = self._request {
if let v = _storage._request { try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
try visitor.visitSingularMessageField(value: v, fieldNumber: 2) }
} if let v = self._response {
if let v = _storage._response { try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
}
} }
try unknownFields.traverse(visitor: &visitor) try unknownFields.traverse(visitor: &visitor)
} }
static func ==(lhs: WebSocketProtos_WebSocketMessage, rhs: WebSocketProtos_WebSocketMessage) -> Bool { static func ==(lhs: WebSocketProtos_WebSocketMessage, rhs: WebSocketProtos_WebSocketMessage) -> Bool {
if lhs._storage !== rhs._storage { if lhs._type != rhs._type {return false}
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in if lhs._request != rhs._request {return false}
let _storage = _args.0 if lhs._response != rhs._response {return false}
let rhs_storage = _args.1
if _storage._type != rhs_storage._type {return false}
if _storage._request != rhs_storage._request {return false}
if _storage._response != rhs_storage._response {return false}
return true
}
if !storagesAreEqual {return false}
}
if lhs.unknownFields != rhs.unknownFields {return false} if lhs.unknownFields != rhs.unknownFields {return false}
return true return true
} }

@ -209,7 +209,6 @@ message DataMessage {
optional LokiProfile profile = 101; optional LokiProfile profile = 101;
optional ClosedGroupControlMessage closedGroupControlMessage = 104; optional ClosedGroupControlMessage closedGroupControlMessage = 104;
optional string syncTarget = 105; optional string syncTarget = 105;
optional PublicChatInfo publicChatInfo = 999;
} }
message ConfigurationMessage { message ConfigurationMessage {
@ -222,11 +221,19 @@ message ConfigurationMessage {
repeated bytes admins = 5; repeated bytes admins = 5;
} }
message Contact {
optional bytes publicKey = 1;
optional string name = 2;
optional string profilePicture = 3;
optional bytes profileKey = 4;
}
repeated ClosedGroup closedGroups = 1; repeated ClosedGroup closedGroups = 1;
repeated string openGroups = 2; repeated string openGroups = 2;
optional string displayName = 3; optional string displayName = 3;
optional string profilePicture = 4; optional string profilePicture = 4;
optional bytes profileKey = 5; optional bytes profileKey = 5;
repeated Contact contacts = 6;
} }
message ReceiptMessage { message ReceiptMessage {
@ -262,26 +269,6 @@ message AttachmentPointer {
optional string url = 101; optional string url = 101;
} }
message GroupContext {
enum Type {
UNKNOWN = 0;
UPDATE = 1;
DELIVER = 2;
QUIT = 3;
REQUEST_INFO = 4;
}
// @required
optional bytes id = 1;
// @required
optional Type type = 2;
optional string name = 3;
repeated string members = 4;
optional AttachmentPointer avatar = 5;
repeated string admins = 6;
}
message ContactDetails { message ContactDetails {
message Avatar { message Avatar {
@ -300,25 +287,24 @@ message ContactDetails {
optional string nickname = 101; optional string nickname = 101;
} }
message GroupDetails { // -------- Deprecated --------
message Avatar { message GroupContext {
optional string contentType = 1;
optional uint32 length = 2; enum Type {
UNKNOWN = 0;
UPDATE = 1;
DELIVER = 2;
QUIT = 3;
REQUEST_INFO = 4;
} }
// @required // @required
optional bytes id = 1; optional bytes id = 1;
optional string name = 2; // @required
repeated string members = 3; optional Type type = 2;
optional Avatar avatar = 4; optional string name = 3;
optional bool active = 5 [default = true]; repeated string members = 4;
optional uint32 expireTimer = 6; optional AttachmentPointer avatar = 5;
optional string color = 7; repeated string admins = 6;
optional bool blocked = 8;
repeated string admins = 9;
}
message PublicChatInfo { // Intended for internal use only
optional uint64 serverID = 1;
} }

@ -135,12 +135,6 @@ public final class OpenGroupPoller : NSObject {
dataMessageProto.setProfileKey(profilePicture.profileKey) dataMessageProto.setProfileKey(profilePicture.profileKey)
} }
dataMessageProto.setProfile(try! profileProto.build()) dataMessageProto.setProfile(try! profileProto.build())
// Open group info
if let messageServerID = message.serverID {
let openGroupProto = SNProtoPublicChatInfo.builder()
openGroupProto.setServerID(messageServerID)
dataMessageProto.setPublicChatInfo(try! openGroupProto.build())
}
// Signal group context // Signal group context
let groupProto = SNProtoGroupContext.builder(id: id, type: .deliver) let groupProto = SNProtoGroupContext.builder(id: id, type: .deliver)
groupProto.setName(openGroup.displayName) groupProto.setName(openGroup.displayName)

Loading…
Cancel
Save