github.com/status-im/status-go@v1.1.0/protocol/messenger_handlers.go (about) 1 //nolint 2 // Code generated by generate_handlers.go. DO NOT EDIT. 3 // source: generate_handlers.go 4 5 package protocol 6 7 import ( 8 "errors" 9 10 "github.com/golang/protobuf/proto" 11 "go.uber.org/zap" 12 13 "github.com/status-im/status-go/protocol/common" 14 "github.com/status-im/status-go/protocol/protobuf" 15 "github.com/status-im/status-go/protocol/transport" 16 v1protocol "github.com/status-im/status-go/protocol/v1" 17 ) 18 19 func (m *Messenger) dispatchToHandler(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter, fromArchive bool) error { 20 switch msg.ApplicationLayer.Type { 21 22 case protobuf.ApplicationMetadataMessage_CHAT_MESSAGE: 23 return m.handleChatMessageProtobuf(messageState, protoBytes, msg, filter, fromArchive) 24 25 case protobuf.ApplicationMetadataMessage_CONTACT_UPDATE: 26 return m.handleContactUpdateProtobuf(messageState, protoBytes, msg, filter) 27 28 case protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE: 29 return m.handleMembershipUpdateMessageProtobuf(messageState, protoBytes, msg, filter) 30 31 case protobuf.ApplicationMetadataMessage_SYNC_PAIR_INSTALLATION: 32 return m.handleSyncPairInstallationProtobuf(messageState, protoBytes, msg, filter) 33 34 case protobuf.ApplicationMetadataMessage_REQUEST_ADDRESS_FOR_TRANSACTION: 35 return m.handleRequestAddressForTransactionProtobuf(messageState, protoBytes, msg, filter) 36 37 case protobuf.ApplicationMetadataMessage_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION: 38 return m.handleAcceptRequestAddressForTransactionProtobuf(messageState, protoBytes, msg, filter) 39 40 case protobuf.ApplicationMetadataMessage_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION: 41 return m.handleDeclineRequestAddressForTransactionProtobuf(messageState, protoBytes, msg, filter) 42 43 case protobuf.ApplicationMetadataMessage_REQUEST_TRANSACTION: 44 return m.handleRequestTransactionProtobuf(messageState, protoBytes, msg, filter) 45 46 case protobuf.ApplicationMetadataMessage_SEND_TRANSACTION: 47 return m.handleSendTransactionProtobuf(messageState, protoBytes, msg, filter) 48 49 case protobuf.ApplicationMetadataMessage_DECLINE_REQUEST_TRANSACTION: 50 return m.handleDeclineRequestTransactionProtobuf(messageState, protoBytes, msg, filter) 51 52 case protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_CONTACT_V2: 53 return m.handleSyncInstallationContactV2Protobuf(messageState, protoBytes, msg, filter) 54 55 case protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_ACCOUNT: 56 return m.handleSyncInstallationAccountProtobuf(messageState, protoBytes, msg, filter) 57 58 case protobuf.ApplicationMetadataMessage_CONTACT_CODE_ADVERTISEMENT: 59 return m.handleContactCodeAdvertisementProtobuf(messageState, protoBytes, msg, filter) 60 61 case protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_REGISTRATION: 62 return m.handlePushNotificationRegistrationProtobuf(messageState, protoBytes, msg, filter) 63 64 case protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_REGISTRATION_RESPONSE: 65 return m.handlePushNotificationRegistrationResponseProtobuf(messageState, protoBytes, msg, filter) 66 67 case protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_QUERY: 68 return m.handlePushNotificationQueryProtobuf(messageState, protoBytes, msg, filter) 69 70 case protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_QUERY_RESPONSE: 71 return m.handlePushNotificationQueryResponseProtobuf(messageState, protoBytes, msg, filter) 72 73 case protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_REQUEST: 74 return m.handlePushNotificationRequestProtobuf(messageState, protoBytes, msg, filter) 75 76 case protobuf.ApplicationMetadataMessage_PUSH_NOTIFICATION_RESPONSE: 77 return m.handlePushNotificationResponseProtobuf(messageState, protoBytes, msg, filter) 78 79 case protobuf.ApplicationMetadataMessage_EMOJI_REACTION: 80 return m.handleEmojiReactionProtobuf(messageState, protoBytes, msg, filter) 81 82 case protobuf.ApplicationMetadataMessage_GROUP_CHAT_INVITATION: 83 return m.handleGroupChatInvitationProtobuf(messageState, protoBytes, msg, filter) 84 85 case protobuf.ApplicationMetadataMessage_CHAT_IDENTITY: 86 return m.handleChatIdentityProtobuf(messageState, protoBytes, msg, filter) 87 88 case protobuf.ApplicationMetadataMessage_COMMUNITY_DESCRIPTION: 89 return m.handleCommunityDescriptionProtobuf(messageState, protoBytes, msg, filter) 90 91 case protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_JOIN: 92 return m.handleCommunityRequestToJoinProtobuf(messageState, protoBytes, msg, filter) 93 94 case protobuf.ApplicationMetadataMessage_PIN_MESSAGE: 95 return m.handlePinMessageProtobuf(messageState, protoBytes, msg, filter, fromArchive) 96 97 case protobuf.ApplicationMetadataMessage_EDIT_MESSAGE: 98 return m.handleEditMessageProtobuf(messageState, protoBytes, msg, filter) 99 100 case protobuf.ApplicationMetadataMessage_STATUS_UPDATE: 101 return m.handleStatusUpdateProtobuf(messageState, protoBytes, msg, filter) 102 103 case protobuf.ApplicationMetadataMessage_DELETE_MESSAGE: 104 return m.handleDeleteMessageProtobuf(messageState, protoBytes, msg, filter) 105 106 case protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_COMMUNITY: 107 return m.handleSyncInstallationCommunityProtobuf(messageState, protoBytes, msg, filter) 108 109 case protobuf.ApplicationMetadataMessage_ANONYMOUS_METRIC_BATCH: 110 return m.handleAnonymousMetricBatchProtobuf(messageState, protoBytes, msg, filter) 111 112 case protobuf.ApplicationMetadataMessage_SYNC_CHAT_REMOVED: 113 return m.handleSyncChatRemovedProtobuf(messageState, protoBytes, msg, filter) 114 115 case protobuf.ApplicationMetadataMessage_SYNC_CHAT_MESSAGES_READ: 116 return m.handleSyncChatMessagesReadProtobuf(messageState, protoBytes, msg, filter) 117 118 case protobuf.ApplicationMetadataMessage_BACKUP: 119 return m.handleBackupProtobuf(messageState, protoBytes, msg, filter) 120 121 case protobuf.ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_READ: 122 return m.handleSyncActivityCenterReadProtobuf(messageState, protoBytes, msg, filter) 123 124 case protobuf.ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_ACCEPTED: 125 return m.handleSyncActivityCenterAcceptedProtobuf(messageState, protoBytes, msg, filter) 126 127 case protobuf.ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_DISMISSED: 128 return m.handleSyncActivityCenterDismissedProtobuf(messageState, protoBytes, msg, filter) 129 130 case protobuf.ApplicationMetadataMessage_SYNC_BOOKMARK: 131 return m.handleSyncBookmarkProtobuf(messageState, protoBytes, msg, filter) 132 133 case protobuf.ApplicationMetadataMessage_SYNC_CLEAR_HISTORY: 134 return m.handleSyncClearHistoryProtobuf(messageState, protoBytes, msg, filter) 135 136 case protobuf.ApplicationMetadataMessage_SYNC_SETTING: 137 return m.handleSyncSettingProtobuf(messageState, protoBytes, msg, filter) 138 139 case protobuf.ApplicationMetadataMessage_COMMUNITY_MESSAGE_ARCHIVE_MAGNETLINK: 140 return m.handleCommunityMessageArchiveMagnetlinkProtobuf(messageState, protoBytes, msg, filter) 141 142 case protobuf.ApplicationMetadataMessage_SYNC_PROFILE_PICTURES: 143 return m.handleSyncProfilePicturesProtobuf(messageState, protoBytes, msg, filter) 144 145 case protobuf.ApplicationMetadataMessage_SYNC_ACCOUNT: 146 return m.handleSyncAccountProtobuf(messageState, protoBytes, msg, filter) 147 148 case protobuf.ApplicationMetadataMessage_ACCEPT_CONTACT_REQUEST: 149 return m.handleAcceptContactRequestProtobuf(messageState, protoBytes, msg, filter) 150 151 case protobuf.ApplicationMetadataMessage_RETRACT_CONTACT_REQUEST: 152 return m.handleRetractContactRequestProtobuf(messageState, protoBytes, msg, filter) 153 154 case protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_JOIN_RESPONSE: 155 return m.handleCommunityRequestToJoinResponseProtobuf(messageState, protoBytes, msg, filter) 156 157 case protobuf.ApplicationMetadataMessage_SYNC_COMMUNITY_SETTINGS: 158 return m.handleSyncCommunitySettingsProtobuf(messageState, protoBytes, msg, filter) 159 160 case protobuf.ApplicationMetadataMessage_REQUEST_CONTACT_VERIFICATION: 161 return m.handleRequestContactVerificationProtobuf(messageState, protoBytes, msg, filter) 162 163 case protobuf.ApplicationMetadataMessage_ACCEPT_CONTACT_VERIFICATION: 164 return m.handleAcceptContactVerificationProtobuf(messageState, protoBytes, msg, filter) 165 166 case protobuf.ApplicationMetadataMessage_DECLINE_CONTACT_VERIFICATION: 167 return m.handleDeclineContactVerificationProtobuf(messageState, protoBytes, msg, filter) 168 169 case protobuf.ApplicationMetadataMessage_SYNC_TRUSTED_USER: 170 return m.handleSyncTrustedUserProtobuf(messageState, protoBytes, msg, filter) 171 172 case protobuf.ApplicationMetadataMessage_SYNC_VERIFICATION_REQUEST: 173 return m.handleSyncVerificationRequestProtobuf(messageState, protoBytes, msg, filter) 174 175 case protobuf.ApplicationMetadataMessage_SYNC_CONTACT_REQUEST_DECISION: 176 return m.handleSyncContactRequestDecisionProtobuf(messageState, protoBytes, msg, filter) 177 178 case protobuf.ApplicationMetadataMessage_COMMUNITY_REQUEST_TO_LEAVE: 179 return m.handleCommunityRequestToLeaveProtobuf(messageState, protoBytes, msg, filter) 180 181 case protobuf.ApplicationMetadataMessage_SYNC_DELETE_FOR_ME_MESSAGE: 182 return m.handleSyncDeleteForMeMessageProtobuf(messageState, protoBytes, msg, filter) 183 184 case protobuf.ApplicationMetadataMessage_SYNC_SAVED_ADDRESS: 185 return m.handleSyncSavedAddressProtobuf(messageState, protoBytes, msg, filter) 186 187 case protobuf.ApplicationMetadataMessage_COMMUNITY_CANCEL_REQUEST_TO_JOIN: 188 return m.handleCommunityCancelRequestToJoinProtobuf(messageState, protoBytes, msg, filter) 189 190 case protobuf.ApplicationMetadataMessage_CANCEL_CONTACT_VERIFICATION: 191 return m.handleCancelContactVerificationProtobuf(messageState, protoBytes, msg, filter) 192 193 case protobuf.ApplicationMetadataMessage_SYNC_KEYPAIR: 194 return m.handleSyncKeypairProtobuf(messageState, protoBytes, msg, filter) 195 196 case protobuf.ApplicationMetadataMessage_SYNC_ENS_USERNAME_DETAIL: 197 return m.handleSyncEnsUsernameDetailProtobuf(messageState, protoBytes, msg, filter) 198 199 case protobuf.ApplicationMetadataMessage_COMMUNITY_EVENTS_MESSAGE: 200 return m.handleCommunityEventsMessageProtobuf(messageState, protoBytes, msg, filter) 201 202 case protobuf.ApplicationMetadataMessage_COMMUNITY_EDIT_SHARED_ADDRESSES: 203 return m.handleCommunityEditSharedAddressesProtobuf(messageState, protoBytes, msg, filter) 204 205 case protobuf.ApplicationMetadataMessage_SYNC_ACCOUNT_CUSTOMIZATION_COLOR: 206 return m.handleSyncAccountCustomizationColorProtobuf(messageState, protoBytes, msg, filter) 207 208 case protobuf.ApplicationMetadataMessage_SYNC_ACCOUNTS_POSITIONS: 209 return m.handleSyncAccountsPositionsProtobuf(messageState, protoBytes, msg, filter) 210 211 case protobuf.ApplicationMetadataMessage_COMMUNITY_PRIVILEGED_USER_SYNC_MESSAGE: 212 return m.handleCommunityPrivilegedUserSyncMessageProtobuf(messageState, protoBytes, msg, filter) 213 214 case protobuf.ApplicationMetadataMessage_COMMUNITY_SHARD_KEY: 215 return m.handleCommunityShardKeyProtobuf(messageState, protoBytes, msg, filter) 216 217 case protobuf.ApplicationMetadataMessage_SYNC_CHAT: 218 return m.handleSyncChatProtobuf(messageState, protoBytes, msg, filter) 219 220 case protobuf.ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_DELETED: 221 return m.handleSyncActivityCenterDeletedProtobuf(messageState, protoBytes, msg, filter) 222 223 case protobuf.ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_UNREAD: 224 return m.handleSyncActivityCenterUnreadProtobuf(messageState, protoBytes, msg, filter) 225 226 case protobuf.ApplicationMetadataMessage_SYNC_ACTIVITY_CENTER_COMMUNITY_REQUEST_DECISION: 227 return m.handleSyncActivityCenterCommunityRequestDecisionProtobuf(messageState, protoBytes, msg, filter) 228 229 case protobuf.ApplicationMetadataMessage_SYNC_TOKEN_PREFERENCES: 230 return m.handleSyncTokenPreferencesProtobuf(messageState, protoBytes, msg, filter) 231 232 case protobuf.ApplicationMetadataMessage_COMMUNITY_PUBLIC_SHARD_INFO: 233 return m.handleCommunityPublicShardInfoProtobuf(messageState, protoBytes, msg, filter) 234 235 case protobuf.ApplicationMetadataMessage_SYNC_COLLECTIBLE_PREFERENCES: 236 return m.handleSyncCollectiblePreferencesProtobuf(messageState, protoBytes, msg, filter) 237 238 case protobuf.ApplicationMetadataMessage_COMMUNITY_USER_KICKED: 239 return m.handleCommunityUserKickedProtobuf(messageState, protoBytes, msg, filter) 240 241 case protobuf.ApplicationMetadataMessage_SYNC_PROFILE_SHOWCASE_PREFERENCES: 242 return m.handleSyncProfileShowcasePreferencesProtobuf(messageState, protoBytes, msg, filter) 243 244 case protobuf.ApplicationMetadataMessage_COMMUNITY_PUBLIC_STORENODES_INFO: 245 return m.handleCommunityPublicStorenodesInfoProtobuf(messageState, protoBytes, msg, filter) 246 247 case protobuf.ApplicationMetadataMessage_COMMUNITY_REEVALUATE_PERMISSIONS_REQUEST: 248 return m.handleCommunityReevaluatePermissionsRequestProtobuf(messageState, protoBytes, msg, filter) 249 250 case protobuf.ApplicationMetadataMessage_DELETE_COMMUNITY_MEMBER_MESSAGES: 251 return m.handleDeleteCommunityMemberMessagesProtobuf(messageState, protoBytes, msg, filter) 252 253 case protobuf.ApplicationMetadataMessage_COMMUNITY_UPDATE_GRANT: 254 return m.handleCommunityUpdateGrantProtobuf(messageState, protoBytes, msg, filter) 255 256 case protobuf.ApplicationMetadataMessage_COMMUNITY_ENCRYPTION_KEYS_REQUEST: 257 return m.handleCommunityEncryptionKeysRequestProtobuf(messageState, protoBytes, msg, filter) 258 259 case protobuf.ApplicationMetadataMessage_COMMUNITY_TOKEN_ACTION: 260 return m.handleCommunityTokenActionProtobuf(messageState, protoBytes, msg, filter) 261 262 case protobuf.ApplicationMetadataMessage_COMMUNITY_SHARED_ADDRESSES_REQUEST: 263 return m.handleCommunitySharedAddressesRequestProtobuf(messageState, protoBytes, msg, filter) 264 265 case protobuf.ApplicationMetadataMessage_COMMUNITY_SHARED_ADDRESSES_RESPONSE: 266 return m.handleCommunitySharedAddressesResponseProtobuf(messageState, protoBytes, msg, filter) 267 268 default: 269 m.logger.Info("protobuf type not found", zap.String("type", string(msg.ApplicationLayer.Type))) 270 return errors.New("protobuf type not found") 271 } 272 return nil 273 } 274 275 276 func (m *Messenger) handleChatMessageProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter, fromArchive bool) error { 277 m.logger.Info("handling ChatMessage") 278 279 280 281 p := &protobuf.ChatMessage{} 282 err := proto.Unmarshal(protoBytes, p) 283 if err != nil { 284 return err 285 } 286 287 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 288 289 return m.HandleChatMessage(messageState, p, msg, fromArchive ) 290 291 } 292 293 294 func (m *Messenger) handleContactUpdateProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 295 m.logger.Info("handling ContactUpdate") 296 297 298 299 p := &protobuf.ContactUpdate{} 300 err := proto.Unmarshal(protoBytes, p) 301 if err != nil { 302 return err 303 } 304 305 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 306 307 return m.HandleContactUpdate(messageState, p, msg) 308 309 } 310 311 312 func (m *Messenger) handleMembershipUpdateMessageProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 313 m.logger.Info("handling MembershipUpdateMessage") 314 315 316 317 p := &protobuf.MembershipUpdateMessage{} 318 err := proto.Unmarshal(protoBytes, p) 319 if err != nil { 320 return err 321 } 322 323 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 324 325 return m.HandleMembershipUpdateMessage(messageState, p, msg) 326 327 } 328 329 330 func (m *Messenger) handleSyncPairInstallationProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 331 m.logger.Info("handling SyncPairInstallation") 332 333 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 334 m.logger.Warn("not coming from us, ignoring") 335 return nil 336 } 337 338 339 340 p := &protobuf.SyncPairInstallation{} 341 err := proto.Unmarshal(protoBytes, p) 342 if err != nil { 343 return err 344 } 345 346 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 347 348 return m.HandleSyncPairInstallation(messageState, p, msg) 349 350 } 351 352 353 func (m *Messenger) handleRequestAddressForTransactionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 354 m.logger.Info("handling RequestAddressForTransaction") 355 356 357 358 p := &protobuf.RequestAddressForTransaction{} 359 err := proto.Unmarshal(protoBytes, p) 360 if err != nil { 361 return err 362 } 363 364 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 365 366 return m.HandleRequestAddressForTransaction(messageState, p, msg) 367 368 } 369 370 371 func (m *Messenger) handleAcceptRequestAddressForTransactionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 372 m.logger.Info("handling AcceptRequestAddressForTransaction") 373 374 375 376 p := &protobuf.AcceptRequestAddressForTransaction{} 377 err := proto.Unmarshal(protoBytes, p) 378 if err != nil { 379 return err 380 } 381 382 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 383 384 return m.HandleAcceptRequestAddressForTransaction(messageState, p, msg) 385 386 } 387 388 389 func (m *Messenger) handleDeclineRequestAddressForTransactionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 390 m.logger.Info("handling DeclineRequestAddressForTransaction") 391 392 393 394 p := &protobuf.DeclineRequestAddressForTransaction{} 395 err := proto.Unmarshal(protoBytes, p) 396 if err != nil { 397 return err 398 } 399 400 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 401 402 return m.HandleDeclineRequestAddressForTransaction(messageState, p, msg) 403 404 } 405 406 407 func (m *Messenger) handleRequestTransactionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 408 m.logger.Info("handling RequestTransaction") 409 410 411 412 p := &protobuf.RequestTransaction{} 413 err := proto.Unmarshal(protoBytes, p) 414 if err != nil { 415 return err 416 } 417 418 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 419 420 return m.HandleRequestTransaction(messageState, p, msg) 421 422 } 423 424 425 func (m *Messenger) handleSendTransactionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 426 m.logger.Info("handling SendTransaction") 427 428 429 430 p := &protobuf.SendTransaction{} 431 err := proto.Unmarshal(protoBytes, p) 432 if err != nil { 433 return err 434 } 435 436 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 437 438 return m.HandleSendTransaction(messageState, p, msg) 439 440 } 441 442 443 func (m *Messenger) handleDeclineRequestTransactionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 444 m.logger.Info("handling DeclineRequestTransaction") 445 446 447 448 p := &protobuf.DeclineRequestTransaction{} 449 err := proto.Unmarshal(protoBytes, p) 450 if err != nil { 451 return err 452 } 453 454 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 455 456 return m.HandleDeclineRequestTransaction(messageState, p, msg) 457 458 } 459 460 461 func (m *Messenger) handleSyncInstallationContactV2Protobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 462 m.logger.Info("handling SyncInstallationContactV2") 463 464 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 465 m.logger.Warn("not coming from us, ignoring") 466 return nil 467 } 468 469 470 471 p := &protobuf.SyncInstallationContactV2{} 472 err := proto.Unmarshal(protoBytes, p) 473 if err != nil { 474 return err 475 } 476 477 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 478 479 return m.HandleSyncInstallationContactV2(messageState, p, msg) 480 481 } 482 483 484 func (m *Messenger) handleSyncInstallationAccountProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 485 m.logger.Info("handling SyncInstallationAccount") 486 487 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 488 m.logger.Warn("not coming from us, ignoring") 489 return nil 490 } 491 492 493 494 p := &protobuf.SyncInstallationAccount{} 495 err := proto.Unmarshal(protoBytes, p) 496 if err != nil { 497 return err 498 } 499 500 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 501 502 return m.HandleSyncInstallationAccount(messageState, p, msg) 503 504 } 505 506 507 func (m *Messenger) handleContactCodeAdvertisementProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 508 m.logger.Info("handling ContactCodeAdvertisement") 509 510 511 512 p := &protobuf.ContactCodeAdvertisement{} 513 err := proto.Unmarshal(protoBytes, p) 514 if err != nil { 515 return err 516 } 517 518 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 519 520 return m.HandleContactCodeAdvertisement(messageState, p, msg) 521 522 } 523 524 525 func (m *Messenger) handlePushNotificationRegistrationProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 526 m.logger.Info("handling PushNotificationRegistration") 527 528 529 530 return m.HandlePushNotificationRegistration(messageState, protoBytes, msg) 531 532 } 533 534 535 func (m *Messenger) handlePushNotificationRegistrationResponseProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 536 m.logger.Info("handling PushNotificationRegistrationResponse") 537 538 539 540 p := &protobuf.PushNotificationRegistrationResponse{} 541 err := proto.Unmarshal(protoBytes, p) 542 if err != nil { 543 return err 544 } 545 546 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 547 548 return m.HandlePushNotificationRegistrationResponse(messageState, p, msg) 549 550 } 551 552 553 func (m *Messenger) handlePushNotificationQueryProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 554 m.logger.Info("handling PushNotificationQuery") 555 556 557 558 p := &protobuf.PushNotificationQuery{} 559 err := proto.Unmarshal(protoBytes, p) 560 if err != nil { 561 return err 562 } 563 564 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 565 566 return m.HandlePushNotificationQuery(messageState, p, msg) 567 568 } 569 570 571 func (m *Messenger) handlePushNotificationQueryResponseProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 572 m.logger.Info("handling PushNotificationQueryResponse") 573 574 575 576 p := &protobuf.PushNotificationQueryResponse{} 577 err := proto.Unmarshal(protoBytes, p) 578 if err != nil { 579 return err 580 } 581 582 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 583 584 return m.HandlePushNotificationQueryResponse(messageState, p, msg) 585 586 } 587 588 589 func (m *Messenger) handlePushNotificationRequestProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 590 m.logger.Info("handling PushNotificationRequest") 591 592 593 594 p := &protobuf.PushNotificationRequest{} 595 err := proto.Unmarshal(protoBytes, p) 596 if err != nil { 597 return err 598 } 599 600 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 601 602 return m.HandlePushNotificationRequest(messageState, p, msg) 603 604 } 605 606 607 func (m *Messenger) handlePushNotificationResponseProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 608 m.logger.Info("handling PushNotificationResponse") 609 610 611 612 p := &protobuf.PushNotificationResponse{} 613 err := proto.Unmarshal(protoBytes, p) 614 if err != nil { 615 return err 616 } 617 618 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 619 620 return m.HandlePushNotificationResponse(messageState, p, msg) 621 622 } 623 624 625 func (m *Messenger) handleEmojiReactionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 626 m.logger.Info("handling EmojiReaction") 627 628 629 630 p := &protobuf.EmojiReaction{} 631 err := proto.Unmarshal(protoBytes, p) 632 if err != nil { 633 return err 634 } 635 636 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 637 638 return m.HandleEmojiReaction(messageState, p, msg) 639 640 } 641 642 643 func (m *Messenger) handleGroupChatInvitationProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 644 m.logger.Info("handling GroupChatInvitation") 645 646 647 648 p := &protobuf.GroupChatInvitation{} 649 err := proto.Unmarshal(protoBytes, p) 650 if err != nil { 651 return err 652 } 653 654 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 655 656 return m.HandleGroupChatInvitation(messageState, p, msg) 657 658 } 659 660 661 func (m *Messenger) handleChatIdentityProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 662 m.logger.Info("handling ChatIdentity") 663 664 665 666 p := &protobuf.ChatIdentity{} 667 err := proto.Unmarshal(protoBytes, p) 668 if err != nil { 669 return err 670 } 671 672 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 673 674 return m.HandleChatIdentity(messageState, p, msg) 675 676 } 677 678 679 func (m *Messenger) handleCommunityDescriptionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 680 m.logger.Info("handling CommunityDescription") 681 682 683 684 p := &protobuf.CommunityDescription{} 685 err := proto.Unmarshal(protoBytes, p) 686 if err != nil { 687 return err 688 } 689 690 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 691 692 return m.HandleCommunityDescription(messageState, p, msg) 693 694 } 695 696 697 func (m *Messenger) handleCommunityRequestToJoinProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 698 m.logger.Info("handling CommunityRequestToJoin") 699 700 701 702 p := &protobuf.CommunityRequestToJoin{} 703 err := proto.Unmarshal(protoBytes, p) 704 if err != nil { 705 return err 706 } 707 708 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 709 710 return m.HandleCommunityRequestToJoin(messageState, p, msg) 711 712 } 713 714 715 func (m *Messenger) handlePinMessageProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter, fromArchive bool) error { 716 m.logger.Info("handling PinMessage") 717 718 719 720 p := &protobuf.PinMessage{} 721 err := proto.Unmarshal(protoBytes, p) 722 if err != nil { 723 return err 724 } 725 726 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 727 728 return m.HandlePinMessage(messageState, p, msg, fromArchive ) 729 730 } 731 732 733 func (m *Messenger) handleEditMessageProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 734 m.logger.Info("handling EditMessage") 735 736 737 738 p := &protobuf.EditMessage{} 739 err := proto.Unmarshal(protoBytes, p) 740 if err != nil { 741 return err 742 } 743 744 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 745 746 return m.HandleEditMessage(messageState, p, msg) 747 748 } 749 750 751 func (m *Messenger) handleStatusUpdateProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 752 m.logger.Info("handling StatusUpdate") 753 754 755 756 p := &protobuf.StatusUpdate{} 757 err := proto.Unmarshal(protoBytes, p) 758 if err != nil { 759 return err 760 } 761 762 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 763 764 return m.HandleStatusUpdate(messageState, p, msg) 765 766 } 767 768 769 func (m *Messenger) handleDeleteMessageProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 770 m.logger.Info("handling DeleteMessage") 771 772 773 774 p := &protobuf.DeleteMessage{} 775 err := proto.Unmarshal(protoBytes, p) 776 if err != nil { 777 return err 778 } 779 780 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 781 782 return m.HandleDeleteMessage(messageState, p, msg) 783 784 } 785 786 787 func (m *Messenger) handleSyncInstallationCommunityProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 788 m.logger.Info("handling SyncInstallationCommunity") 789 790 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 791 m.logger.Warn("not coming from us, ignoring") 792 return nil 793 } 794 795 796 797 p := &protobuf.SyncInstallationCommunity{} 798 err := proto.Unmarshal(protoBytes, p) 799 if err != nil { 800 return err 801 } 802 803 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 804 805 return m.HandleSyncInstallationCommunity(messageState, p, msg) 806 807 } 808 809 810 func (m *Messenger) handleAnonymousMetricBatchProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 811 m.logger.Info("handling AnonymousMetricBatch") 812 813 814 815 p := &protobuf.AnonymousMetricBatch{} 816 err := proto.Unmarshal(protoBytes, p) 817 if err != nil { 818 return err 819 } 820 821 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 822 823 return m.HandleAnonymousMetricBatch(messageState, p, msg) 824 825 } 826 827 828 func (m *Messenger) handleSyncChatRemovedProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 829 m.logger.Info("handling SyncChatRemoved") 830 831 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 832 m.logger.Warn("not coming from us, ignoring") 833 return nil 834 } 835 836 837 838 p := &protobuf.SyncChatRemoved{} 839 err := proto.Unmarshal(protoBytes, p) 840 if err != nil { 841 return err 842 } 843 844 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 845 846 return m.HandleSyncChatRemoved(messageState, p, msg) 847 848 } 849 850 851 func (m *Messenger) handleSyncChatMessagesReadProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 852 m.logger.Info("handling SyncChatMessagesRead") 853 854 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 855 m.logger.Warn("not coming from us, ignoring") 856 return nil 857 } 858 859 860 861 p := &protobuf.SyncChatMessagesRead{} 862 err := proto.Unmarshal(protoBytes, p) 863 if err != nil { 864 return err 865 } 866 867 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 868 869 return m.HandleSyncChatMessagesRead(messageState, p, msg) 870 871 } 872 873 874 func (m *Messenger) handleBackupProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 875 m.logger.Info("handling Backup") 876 877 878 879 p := &protobuf.Backup{} 880 err := proto.Unmarshal(protoBytes, p) 881 if err != nil { 882 return err 883 } 884 885 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 886 887 return m.HandleBackup(messageState, p, msg) 888 889 } 890 891 892 func (m *Messenger) handleSyncActivityCenterReadProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 893 m.logger.Info("handling SyncActivityCenterRead") 894 895 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 896 m.logger.Warn("not coming from us, ignoring") 897 return nil 898 } 899 900 901 902 p := &protobuf.SyncActivityCenterRead{} 903 err := proto.Unmarshal(protoBytes, p) 904 if err != nil { 905 return err 906 } 907 908 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 909 910 return m.HandleSyncActivityCenterRead(messageState, p, msg) 911 912 } 913 914 915 func (m *Messenger) handleSyncActivityCenterAcceptedProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 916 m.logger.Info("handling SyncActivityCenterAccepted") 917 918 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 919 m.logger.Warn("not coming from us, ignoring") 920 return nil 921 } 922 923 924 925 p := &protobuf.SyncActivityCenterAccepted{} 926 err := proto.Unmarshal(protoBytes, p) 927 if err != nil { 928 return err 929 } 930 931 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 932 933 return m.HandleSyncActivityCenterAccepted(messageState, p, msg) 934 935 } 936 937 938 func (m *Messenger) handleSyncActivityCenterDismissedProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 939 m.logger.Info("handling SyncActivityCenterDismissed") 940 941 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 942 m.logger.Warn("not coming from us, ignoring") 943 return nil 944 } 945 946 947 948 p := &protobuf.SyncActivityCenterDismissed{} 949 err := proto.Unmarshal(protoBytes, p) 950 if err != nil { 951 return err 952 } 953 954 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 955 956 return m.HandleSyncActivityCenterDismissed(messageState, p, msg) 957 958 } 959 960 961 func (m *Messenger) handleSyncBookmarkProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 962 m.logger.Info("handling SyncBookmark") 963 964 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 965 m.logger.Warn("not coming from us, ignoring") 966 return nil 967 } 968 969 970 971 p := &protobuf.SyncBookmark{} 972 err := proto.Unmarshal(protoBytes, p) 973 if err != nil { 974 return err 975 } 976 977 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 978 979 return m.HandleSyncBookmark(messageState, p, msg) 980 981 } 982 983 984 func (m *Messenger) handleSyncClearHistoryProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 985 m.logger.Info("handling SyncClearHistory") 986 987 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 988 m.logger.Warn("not coming from us, ignoring") 989 return nil 990 } 991 992 993 994 p := &protobuf.SyncClearHistory{} 995 err := proto.Unmarshal(protoBytes, p) 996 if err != nil { 997 return err 998 } 999 1000 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1001 1002 return m.HandleSyncClearHistory(messageState, p, msg) 1003 1004 } 1005 1006 1007 func (m *Messenger) handleSyncSettingProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1008 m.logger.Info("handling SyncSetting") 1009 1010 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1011 m.logger.Warn("not coming from us, ignoring") 1012 return nil 1013 } 1014 1015 1016 1017 p := &protobuf.SyncSetting{} 1018 err := proto.Unmarshal(protoBytes, p) 1019 if err != nil { 1020 return err 1021 } 1022 1023 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1024 1025 return m.HandleSyncSetting(messageState, p, msg) 1026 1027 } 1028 1029 1030 func (m *Messenger) handleCommunityMessageArchiveMagnetlinkProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1031 m.logger.Info("handling CommunityMessageArchiveMagnetlink") 1032 1033 1034 1035 p := &protobuf.CommunityMessageArchiveMagnetlink{} 1036 err := proto.Unmarshal(protoBytes, p) 1037 if err != nil { 1038 return err 1039 } 1040 1041 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1042 1043 return m.HandleCommunityMessageArchiveMagnetlink(messageState, p, msg) 1044 1045 } 1046 1047 1048 func (m *Messenger) handleSyncProfilePicturesProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1049 m.logger.Info("handling SyncProfilePictures") 1050 1051 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1052 m.logger.Warn("not coming from us, ignoring") 1053 return nil 1054 } 1055 1056 1057 1058 p := &protobuf.SyncProfilePictures{} 1059 err := proto.Unmarshal(protoBytes, p) 1060 if err != nil { 1061 return err 1062 } 1063 1064 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1065 1066 return m.HandleSyncProfilePictures(messageState, p, msg) 1067 1068 } 1069 1070 1071 func (m *Messenger) handleSyncAccountProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1072 m.logger.Info("handling SyncAccount") 1073 1074 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1075 m.logger.Warn("not coming from us, ignoring") 1076 return nil 1077 } 1078 1079 1080 1081 p := &protobuf.SyncAccount{} 1082 err := proto.Unmarshal(protoBytes, p) 1083 if err != nil { 1084 return err 1085 } 1086 1087 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1088 1089 return m.HandleSyncAccount(messageState, p, msg) 1090 1091 } 1092 1093 1094 func (m *Messenger) handleAcceptContactRequestProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1095 m.logger.Info("handling AcceptContactRequest") 1096 1097 1098 1099 p := &protobuf.AcceptContactRequest{} 1100 err := proto.Unmarshal(protoBytes, p) 1101 if err != nil { 1102 return err 1103 } 1104 1105 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1106 1107 return m.HandleAcceptContactRequest(messageState, p, msg) 1108 1109 } 1110 1111 1112 func (m *Messenger) handleRetractContactRequestProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1113 m.logger.Info("handling RetractContactRequest") 1114 1115 1116 1117 p := &protobuf.RetractContactRequest{} 1118 err := proto.Unmarshal(protoBytes, p) 1119 if err != nil { 1120 return err 1121 } 1122 1123 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1124 1125 return m.HandleRetractContactRequest(messageState, p, msg) 1126 1127 } 1128 1129 1130 func (m *Messenger) handleCommunityRequestToJoinResponseProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1131 m.logger.Info("handling CommunityRequestToJoinResponse") 1132 1133 1134 1135 p := &protobuf.CommunityRequestToJoinResponse{} 1136 err := proto.Unmarshal(protoBytes, p) 1137 if err != nil { 1138 return err 1139 } 1140 1141 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1142 1143 return m.HandleCommunityRequestToJoinResponse(messageState, p, msg) 1144 1145 } 1146 1147 1148 func (m *Messenger) handleSyncCommunitySettingsProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1149 m.logger.Info("handling SyncCommunitySettings") 1150 1151 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1152 m.logger.Warn("not coming from us, ignoring") 1153 return nil 1154 } 1155 1156 1157 1158 p := &protobuf.SyncCommunitySettings{} 1159 err := proto.Unmarshal(protoBytes, p) 1160 if err != nil { 1161 return err 1162 } 1163 1164 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1165 1166 return m.HandleSyncCommunitySettings(messageState, p, msg) 1167 1168 } 1169 1170 1171 func (m *Messenger) handleRequestContactVerificationProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1172 m.logger.Info("handling RequestContactVerification") 1173 1174 1175 1176 p := &protobuf.RequestContactVerification{} 1177 err := proto.Unmarshal(protoBytes, p) 1178 if err != nil { 1179 return err 1180 } 1181 1182 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1183 1184 return m.HandleRequestContactVerification(messageState, p, msg) 1185 1186 } 1187 1188 1189 func (m *Messenger) handleAcceptContactVerificationProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1190 m.logger.Info("handling AcceptContactVerification") 1191 1192 1193 1194 p := &protobuf.AcceptContactVerification{} 1195 err := proto.Unmarshal(protoBytes, p) 1196 if err != nil { 1197 return err 1198 } 1199 1200 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1201 1202 return m.HandleAcceptContactVerification(messageState, p, msg) 1203 1204 } 1205 1206 1207 func (m *Messenger) handleDeclineContactVerificationProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1208 m.logger.Info("handling DeclineContactVerification") 1209 1210 1211 1212 p := &protobuf.DeclineContactVerification{} 1213 err := proto.Unmarshal(protoBytes, p) 1214 if err != nil { 1215 return err 1216 } 1217 1218 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1219 1220 return m.HandleDeclineContactVerification(messageState, p, msg) 1221 1222 } 1223 1224 1225 func (m *Messenger) handleSyncTrustedUserProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1226 m.logger.Info("handling SyncTrustedUser") 1227 1228 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1229 m.logger.Warn("not coming from us, ignoring") 1230 return nil 1231 } 1232 1233 1234 1235 p := &protobuf.SyncTrustedUser{} 1236 err := proto.Unmarshal(protoBytes, p) 1237 if err != nil { 1238 return err 1239 } 1240 1241 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1242 1243 return m.HandleSyncTrustedUser(messageState, p, msg) 1244 1245 } 1246 1247 1248 func (m *Messenger) handleSyncVerificationRequestProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1249 m.logger.Info("handling SyncVerificationRequest") 1250 1251 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1252 m.logger.Warn("not coming from us, ignoring") 1253 return nil 1254 } 1255 1256 1257 1258 p := &protobuf.SyncVerificationRequest{} 1259 err := proto.Unmarshal(protoBytes, p) 1260 if err != nil { 1261 return err 1262 } 1263 1264 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1265 1266 return m.HandleSyncVerificationRequest(messageState, p, msg) 1267 1268 } 1269 1270 1271 func (m *Messenger) handleSyncContactRequestDecisionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1272 m.logger.Info("handling SyncContactRequestDecision") 1273 1274 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1275 m.logger.Warn("not coming from us, ignoring") 1276 return nil 1277 } 1278 1279 1280 1281 p := &protobuf.SyncContactRequestDecision{} 1282 err := proto.Unmarshal(protoBytes, p) 1283 if err != nil { 1284 return err 1285 } 1286 1287 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1288 1289 return m.HandleSyncContactRequestDecision(messageState, p, msg) 1290 1291 } 1292 1293 1294 func (m *Messenger) handleCommunityRequestToLeaveProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1295 m.logger.Info("handling CommunityRequestToLeave") 1296 1297 1298 1299 p := &protobuf.CommunityRequestToLeave{} 1300 err := proto.Unmarshal(protoBytes, p) 1301 if err != nil { 1302 return err 1303 } 1304 1305 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1306 1307 return m.HandleCommunityRequestToLeave(messageState, p, msg) 1308 1309 } 1310 1311 1312 func (m *Messenger) handleSyncDeleteForMeMessageProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1313 m.logger.Info("handling SyncDeleteForMeMessage") 1314 1315 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1316 m.logger.Warn("not coming from us, ignoring") 1317 return nil 1318 } 1319 1320 1321 1322 p := &protobuf.SyncDeleteForMeMessage{} 1323 err := proto.Unmarshal(protoBytes, p) 1324 if err != nil { 1325 return err 1326 } 1327 1328 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1329 1330 return m.HandleSyncDeleteForMeMessage(messageState, p, msg) 1331 1332 } 1333 1334 1335 func (m *Messenger) handleSyncSavedAddressProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1336 m.logger.Info("handling SyncSavedAddress") 1337 1338 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1339 m.logger.Warn("not coming from us, ignoring") 1340 return nil 1341 } 1342 1343 1344 1345 p := &protobuf.SyncSavedAddress{} 1346 err := proto.Unmarshal(protoBytes, p) 1347 if err != nil { 1348 return err 1349 } 1350 1351 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1352 1353 return m.HandleSyncSavedAddress(messageState, p, msg) 1354 1355 } 1356 1357 1358 func (m *Messenger) handleCommunityCancelRequestToJoinProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1359 m.logger.Info("handling CommunityCancelRequestToJoin") 1360 1361 1362 1363 p := &protobuf.CommunityCancelRequestToJoin{} 1364 err := proto.Unmarshal(protoBytes, p) 1365 if err != nil { 1366 return err 1367 } 1368 1369 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1370 1371 return m.HandleCommunityCancelRequestToJoin(messageState, p, msg) 1372 1373 } 1374 1375 1376 func (m *Messenger) handleCancelContactVerificationProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1377 m.logger.Info("handling CancelContactVerification") 1378 1379 1380 1381 p := &protobuf.CancelContactVerification{} 1382 err := proto.Unmarshal(protoBytes, p) 1383 if err != nil { 1384 return err 1385 } 1386 1387 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1388 1389 return m.HandleCancelContactVerification(messageState, p, msg) 1390 1391 } 1392 1393 1394 func (m *Messenger) handleSyncKeypairProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1395 m.logger.Info("handling SyncKeypair") 1396 1397 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1398 m.logger.Warn("not coming from us, ignoring") 1399 return nil 1400 } 1401 1402 1403 1404 p := &protobuf.SyncKeypair{} 1405 err := proto.Unmarshal(protoBytes, p) 1406 if err != nil { 1407 return err 1408 } 1409 1410 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1411 1412 return m.HandleSyncKeypair(messageState, p, msg) 1413 1414 } 1415 1416 1417 func (m *Messenger) handleSyncEnsUsernameDetailProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1418 m.logger.Info("handling SyncEnsUsernameDetail") 1419 1420 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1421 m.logger.Warn("not coming from us, ignoring") 1422 return nil 1423 } 1424 1425 1426 1427 p := &protobuf.SyncEnsUsernameDetail{} 1428 err := proto.Unmarshal(protoBytes, p) 1429 if err != nil { 1430 return err 1431 } 1432 1433 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1434 1435 return m.HandleSyncEnsUsernameDetail(messageState, p, msg) 1436 1437 } 1438 1439 1440 func (m *Messenger) handleCommunityEventsMessageProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1441 m.logger.Info("handling CommunityEventsMessage") 1442 1443 1444 1445 p := &protobuf.CommunityEventsMessage{} 1446 err := proto.Unmarshal(protoBytes, p) 1447 if err != nil { 1448 return err 1449 } 1450 1451 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1452 1453 return m.HandleCommunityEventsMessage(messageState, p, msg) 1454 1455 } 1456 1457 1458 func (m *Messenger) handleCommunityEditSharedAddressesProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1459 m.logger.Info("handling CommunityEditSharedAddresses") 1460 1461 1462 1463 p := &protobuf.CommunityEditSharedAddresses{} 1464 err := proto.Unmarshal(protoBytes, p) 1465 if err != nil { 1466 return err 1467 } 1468 1469 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1470 1471 return m.HandleCommunityEditSharedAddresses(messageState, p, msg) 1472 1473 } 1474 1475 1476 func (m *Messenger) handleSyncAccountCustomizationColorProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1477 m.logger.Info("handling SyncAccountCustomizationColor") 1478 1479 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1480 m.logger.Warn("not coming from us, ignoring") 1481 return nil 1482 } 1483 1484 1485 1486 p := &protobuf.SyncAccountCustomizationColor{} 1487 err := proto.Unmarshal(protoBytes, p) 1488 if err != nil { 1489 return err 1490 } 1491 1492 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1493 1494 return m.HandleSyncAccountCustomizationColor(messageState, p, msg) 1495 1496 } 1497 1498 1499 func (m *Messenger) handleSyncAccountsPositionsProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1500 m.logger.Info("handling SyncAccountsPositions") 1501 1502 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1503 m.logger.Warn("not coming from us, ignoring") 1504 return nil 1505 } 1506 1507 1508 1509 p := &protobuf.SyncAccountsPositions{} 1510 err := proto.Unmarshal(protoBytes, p) 1511 if err != nil { 1512 return err 1513 } 1514 1515 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1516 1517 return m.HandleSyncAccountsPositions(messageState, p, msg) 1518 1519 } 1520 1521 1522 func (m *Messenger) handleCommunityPrivilegedUserSyncMessageProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1523 m.logger.Info("handling CommunityPrivilegedUserSyncMessage") 1524 1525 1526 1527 p := &protobuf.CommunityPrivilegedUserSyncMessage{} 1528 err := proto.Unmarshal(protoBytes, p) 1529 if err != nil { 1530 return err 1531 } 1532 1533 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1534 1535 return m.HandleCommunityPrivilegedUserSyncMessage(messageState, p, msg) 1536 1537 } 1538 1539 1540 func (m *Messenger) handleCommunityShardKeyProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1541 m.logger.Info("handling CommunityShardKey") 1542 1543 1544 1545 p := &protobuf.CommunityShardKey{} 1546 err := proto.Unmarshal(protoBytes, p) 1547 if err != nil { 1548 return err 1549 } 1550 1551 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1552 1553 return m.HandleCommunityShardKey(messageState, p, msg) 1554 1555 } 1556 1557 1558 func (m *Messenger) handleSyncChatProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1559 m.logger.Info("handling SyncChat") 1560 1561 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1562 m.logger.Warn("not coming from us, ignoring") 1563 return nil 1564 } 1565 1566 1567 1568 p := &protobuf.SyncChat{} 1569 err := proto.Unmarshal(protoBytes, p) 1570 if err != nil { 1571 return err 1572 } 1573 1574 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1575 1576 return m.HandleSyncChat(messageState, p, msg) 1577 1578 } 1579 1580 1581 func (m *Messenger) handleSyncActivityCenterDeletedProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1582 m.logger.Info("handling SyncActivityCenterDeleted") 1583 1584 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1585 m.logger.Warn("not coming from us, ignoring") 1586 return nil 1587 } 1588 1589 1590 1591 p := &protobuf.SyncActivityCenterDeleted{} 1592 err := proto.Unmarshal(protoBytes, p) 1593 if err != nil { 1594 return err 1595 } 1596 1597 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1598 1599 return m.HandleSyncActivityCenterDeleted(messageState, p, msg) 1600 1601 } 1602 1603 1604 func (m *Messenger) handleSyncActivityCenterUnreadProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1605 m.logger.Info("handling SyncActivityCenterUnread") 1606 1607 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1608 m.logger.Warn("not coming from us, ignoring") 1609 return nil 1610 } 1611 1612 1613 1614 p := &protobuf.SyncActivityCenterUnread{} 1615 err := proto.Unmarshal(protoBytes, p) 1616 if err != nil { 1617 return err 1618 } 1619 1620 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1621 1622 return m.HandleSyncActivityCenterUnread(messageState, p, msg) 1623 1624 } 1625 1626 1627 func (m *Messenger) handleSyncActivityCenterCommunityRequestDecisionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1628 m.logger.Info("handling SyncActivityCenterCommunityRequestDecision") 1629 1630 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1631 m.logger.Warn("not coming from us, ignoring") 1632 return nil 1633 } 1634 1635 1636 1637 p := &protobuf.SyncActivityCenterCommunityRequestDecision{} 1638 err := proto.Unmarshal(protoBytes, p) 1639 if err != nil { 1640 return err 1641 } 1642 1643 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1644 1645 return m.HandleSyncActivityCenterCommunityRequestDecision(messageState, p, msg) 1646 1647 } 1648 1649 1650 func (m *Messenger) handleSyncTokenPreferencesProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1651 m.logger.Info("handling SyncTokenPreferences") 1652 1653 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1654 m.logger.Warn("not coming from us, ignoring") 1655 return nil 1656 } 1657 1658 1659 1660 p := &protobuf.SyncTokenPreferences{} 1661 err := proto.Unmarshal(protoBytes, p) 1662 if err != nil { 1663 return err 1664 } 1665 1666 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1667 1668 return m.HandleSyncTokenPreferences(messageState, p, msg) 1669 1670 } 1671 1672 1673 func (m *Messenger) handleCommunityPublicShardInfoProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1674 m.logger.Info("handling CommunityPublicShardInfo") 1675 1676 1677 1678 p := &protobuf.CommunityPublicShardInfo{} 1679 err := proto.Unmarshal(protoBytes, p) 1680 if err != nil { 1681 return err 1682 } 1683 1684 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1685 1686 return m.HandleCommunityPublicShardInfo(messageState, p, msg) 1687 1688 } 1689 1690 1691 func (m *Messenger) handleSyncCollectiblePreferencesProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1692 m.logger.Info("handling SyncCollectiblePreferences") 1693 1694 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1695 m.logger.Warn("not coming from us, ignoring") 1696 return nil 1697 } 1698 1699 1700 1701 p := &protobuf.SyncCollectiblePreferences{} 1702 err := proto.Unmarshal(protoBytes, p) 1703 if err != nil { 1704 return err 1705 } 1706 1707 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1708 1709 return m.HandleSyncCollectiblePreferences(messageState, p, msg) 1710 1711 } 1712 1713 1714 func (m *Messenger) handleCommunityUserKickedProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1715 m.logger.Info("handling CommunityUserKicked") 1716 1717 1718 1719 p := &protobuf.CommunityUserKicked{} 1720 err := proto.Unmarshal(protoBytes, p) 1721 if err != nil { 1722 return err 1723 } 1724 1725 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1726 1727 return m.HandleCommunityUserKicked(messageState, p, msg) 1728 1729 } 1730 1731 1732 func (m *Messenger) handleSyncProfileShowcasePreferencesProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1733 m.logger.Info("handling SyncProfileShowcasePreferences") 1734 1735 if !common.IsPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { 1736 m.logger.Warn("not coming from us, ignoring") 1737 return nil 1738 } 1739 1740 1741 1742 p := &protobuf.SyncProfileShowcasePreferences{} 1743 err := proto.Unmarshal(protoBytes, p) 1744 if err != nil { 1745 return err 1746 } 1747 1748 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1749 1750 return m.HandleSyncProfileShowcasePreferences(messageState, p, msg) 1751 1752 } 1753 1754 1755 func (m *Messenger) handleCommunityPublicStorenodesInfoProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1756 m.logger.Info("handling CommunityPublicStorenodesInfo") 1757 1758 1759 1760 p := &protobuf.CommunityPublicStorenodesInfo{} 1761 err := proto.Unmarshal(protoBytes, p) 1762 if err != nil { 1763 return err 1764 } 1765 1766 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1767 1768 return m.HandleCommunityPublicStorenodesInfo(messageState, p, msg) 1769 1770 } 1771 1772 1773 func (m *Messenger) handleCommunityReevaluatePermissionsRequestProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1774 m.logger.Info("handling CommunityReevaluatePermissionsRequest") 1775 1776 1777 1778 p := &protobuf.CommunityReevaluatePermissionsRequest{} 1779 err := proto.Unmarshal(protoBytes, p) 1780 if err != nil { 1781 return err 1782 } 1783 1784 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1785 1786 return m.HandleCommunityReevaluatePermissionsRequest(messageState, p, msg) 1787 1788 } 1789 1790 1791 func (m *Messenger) handleDeleteCommunityMemberMessagesProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1792 m.logger.Info("handling DeleteCommunityMemberMessages") 1793 1794 1795 1796 p := &protobuf.DeleteCommunityMemberMessages{} 1797 err := proto.Unmarshal(protoBytes, p) 1798 if err != nil { 1799 return err 1800 } 1801 1802 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1803 1804 return m.HandleDeleteCommunityMemberMessages(messageState, p, msg) 1805 1806 } 1807 1808 1809 func (m *Messenger) handleCommunityUpdateGrantProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1810 m.logger.Info("handling CommunityUpdateGrant") 1811 1812 1813 1814 p := &protobuf.CommunityUpdateGrant{} 1815 err := proto.Unmarshal(protoBytes, p) 1816 if err != nil { 1817 return err 1818 } 1819 1820 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1821 1822 return m.HandleCommunityUpdateGrant(messageState, p, msg) 1823 1824 } 1825 1826 1827 func (m *Messenger) handleCommunityEncryptionKeysRequestProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1828 m.logger.Info("handling CommunityEncryptionKeysRequest") 1829 1830 1831 1832 p := &protobuf.CommunityEncryptionKeysRequest{} 1833 err := proto.Unmarshal(protoBytes, p) 1834 if err != nil { 1835 return err 1836 } 1837 1838 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1839 1840 return m.HandleCommunityEncryptionKeysRequest(messageState, p, msg) 1841 1842 } 1843 1844 1845 func (m *Messenger) handleCommunityTokenActionProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1846 m.logger.Info("handling CommunityTokenAction") 1847 1848 1849 1850 p := &protobuf.CommunityTokenAction{} 1851 err := proto.Unmarshal(protoBytes, p) 1852 if err != nil { 1853 return err 1854 } 1855 1856 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1857 1858 return m.HandleCommunityTokenAction(messageState, p, msg) 1859 1860 } 1861 1862 1863 func (m *Messenger) handleCommunitySharedAddressesRequestProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1864 m.logger.Info("handling CommunitySharedAddressesRequest") 1865 1866 1867 1868 p := &protobuf.CommunitySharedAddressesRequest{} 1869 err := proto.Unmarshal(protoBytes, p) 1870 if err != nil { 1871 return err 1872 } 1873 1874 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1875 1876 return m.HandleCommunitySharedAddressesRequest(messageState, p, msg) 1877 1878 } 1879 1880 1881 func (m *Messenger) handleCommunitySharedAddressesResponseProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error { 1882 m.logger.Info("handling CommunitySharedAddressesResponse") 1883 1884 1885 1886 p := &protobuf.CommunitySharedAddressesResponse{} 1887 err := proto.Unmarshal(protoBytes, p) 1888 if err != nil { 1889 return err 1890 } 1891 1892 m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p) 1893 1894 return m.HandleCommunitySharedAddressesResponse(messageState, p, msg) 1895 1896 } 1897 1898