Code Monkey home page Code Monkey logo

matrix-puppet-imessage's People

Contributors

aaronraimist avatar andrewjdr avatar cvincent avatar elmehalawi avatar kfatehi avatar michaelnew avatar nr23730 avatar thomas-profitt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matrix-puppet-imessage's Issues

Handle live photos

dont know how to deal with filetype { roomId: '',
  senderName: '',
  senderId: undefined,
  text: '',
  path: '/Users/keyvan/Library/Messages/Attachments/b8/08/FFA77626-C4F8-4B37-9531-8D7BBC9387EF/IMG_2656.JPG\n/Users/keyvan/Library/Messages/Attachments/b8/08/FFA77626-C4F8-4B37-9531-8D7BBC9387EF/IMG_2656.MOV',
  mimetype: 'video/quicktime' } 

System Integrity Protection has to be turned off when running the bridge on >= macOS 10.14

There was some discussion around this in #matrix-puppet-bridge:matrix.org on 3-29-2019, and I want to put it here so it doesn't get lost. Starting in Mojave you can't watch for file changes in ~/Library/Messages (trying to do ls in that directory fails, for example), so for the bridge to work you have to turn off SIP.

To turn it off, you have to reboot into recovery mode (hold down CMD-R), open Terminal from the Utilities menu, and then csrutil disable. It's also an option that can be set from the boot menu in Clover when running macOS in a VM.

Obviously it would be nice to not have to turn off SIP, but I can't think of any way to get around it. Ultimately we want to watch for file changes and SIP doesn't let you.

I think we should put something in the readme for now.

Outgoing Messages No Longer Sent

A month or so ago, the power went out at my house. After rebooting I can no longer send messages from clients. However, incoming messages still work and messages sent from Apple's messages app are imported properly. Any ideas on resolving this are greatly appreciated.

MacOS: 10.13.6

Error in handleMatrixEvent { Error: could not determine third party room id!
    at App._handleMatrixMessageEvent (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1034:13)
    at App.handleMatrixMessageEvent (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1015:25)
    at App.handleMatrixEvent (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1007:19)
    at Bridge._onConsume (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/lib/bridge.js:856:26)
    at tryCatcher (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/util.js:26:23)
    at Promise.successAdapter (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/nodeify.js:23:30)
    at Promise._settlePromiseAt (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/promise.js:582:21)
    at Promise._settlePromises (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/promise.js:700:14)
    at Async._drainQueue (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:15:14)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
  [stack]:
   'Error: could not determine third party room id!\n    at App._handleMatrixMessageEvent (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1034:13)\n    at App.handleMatrixMessageEvent (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1015:25)\n    at App.handleMatrixEvent (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1007:19)\n    at Bridge._onConsume (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/lib/bridge.js:856:26)\n    at tryCatcher (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/util.js:26:23)\n    at Promise.successAdapter (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/nodeify.js:23:30)\n    at Promise._settlePromiseAt (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/promise.js:582:21)\n    at Promise._settlePromises (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/promise.js:700:14)\n    at Async._drainQueue (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:123:16)\n    at Async._drainQueues (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:133:10)\n    at Immediate.Async.drainQueues (/Users/<USER>/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:15:14)\n    at runCallback (timers.js:705:18)\n    at tryOnImmediate (timers.js:676:5)\n    at processImmediate (timers.js:658:5)',
  [message]: 'could not determine third party room id!' } { age: 118,
  content: { body: 'Test', msgtype: 'm.text' },
  event_id: '$randomstringrandomh_a-eventidearandomstring',
  origin_server_ts: 0000000000000, <number changed>
  room_id: '!roomidchangedyah:<DOMAIN>
  sender: '@<USER>:<DOMAIN>',
  type: 'm.room.message',
  unsigned: { age: 118 },
  user_id: '@<USER>:<DOMAIN>' } 

not recieving messages

my bridge used to work. now, with newest synapse, when i get a new imessage i can see that on both sides (synaspe and puppet-bridge) something is happening, but apparently synapse is not able to invite my matrix user to the preexisting room.

log on puppet-bridge-side:

Matrix-side listening on port 8090
spawning
skiping message:  +00123123123 test
mark message as read
no send event found, returning
skiping message:  e:[email protected] test
mark message as read
no send event found, returning
handling message {
  fileRecipient: 'Contactname am 2020-04-01 um 14.41.15.ichat',
  hash: '9a76eda8ed084e4c6d25be88a967ea73',
  senderIsMe: null,
  sender: '+00123123123',
  service: 'iMessage',
  isRead: true,
  isMultiParty: false,
  chatId: '',
  participantIds: [ 'e:[email protected]', '+00123123123' ],
  message: 'b',
  date: '2020-04-01T14:47:14.422',
  subject: 'e:[email protected]',
  files: []
}
handling message {
  fileRecipient: 'Contactname am 2020-04-01 um 14.41.15.ichat',
  hash: 'c19dc6eef83075d76dd04b9d0cdf0711',
  senderIsMe: [ 'e:', index: 0, input: 'e:[email protected]', groups: undefined ],
  sender: 'e:[email protected]',
  service: 'iMessage',
  isRead: true,
  isMultiParty: false,
  chatId: '',
  participantIds: [ 'e:[email protected]', '+00123123123' ],
  message: 'b',
  date: '2020-04-01T14:47:14.506',
  subject: '+00123123123',
  files: []
}
marking skip:  c19dc6eef83075d76dd04b9d0cdf0711 e:[email protected] b
sendEvent of type m.room.message in !WgsdtXdiIWIWWHryPT:serer.xywith txnId m1585745254069.0
Error sending event [M_FORBIDDEN: User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)] {
  errcode: 'M_FORBIDDEN',
  name: 'M_FORBIDDEN',
  message: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)",
  data: {
    errcode: 'M_FORBIDDEN',
    error: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)"
  },
  httpStatus: 403
}
sendEvent of type m.room.message in !WgsdtXdiIWIWWHryPT:serer.xywith txnId m1585745255531.1
Error sending event [M_FORBIDDEN: User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)] {
  errcode: 'M_FORBIDDEN',
  name: 'M_FORBIDDEN',
  message: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)",
  data: {
    errcode: 'M_FORBIDDEN',
    error: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)"
  },
  httpStatus: 403
}
got ya
sendEvent of type m.room.message in !WgsdtXdiIWIWWHryPT:serer.xywith txnId m1585745256122.0
Event sent to !WgsdtXdiIWIWWHryPT:serer.xywith event id $ohZp7Cpfq9EphHjUwn1_u8sMZmLyWLZyRLyouEL0ws0
sendEvent of type m.room.message in !WgsdtXdiIWIWWHryPT:serer.xywith txnId m1585745256824.2
Error sending event [M_FORBIDDEN: User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)] {
  errcode: 'M_FORBIDDEN',
  name: 'M_FORBIDDEN',
  message: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)",
  data: {
    errcode: 'M_FORBIDDEN',
    error: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)"
  },
  httpStatus: 403
}
making extra ghosts.. [ 'e:[email protected]', '+00123123123' ]
filtered out myself [ '+00123123123' ]
sendEvent of type m.room.message in !WgsdtXdiIWIWWHryPT:serer.xywith txnId m1585745258601.3
joined ghost +00123123123
Error sending event [M_FORBIDDEN: User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)] {
  errcode: 'M_FORBIDDEN',
  name: 'M_FORBIDDEN',
  message: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)",
  data: {
    errcode: 'M_FORBIDDEN',
    error: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)"
  },
  httpStatus: 403
}
sendEvent of type m.room.message in !WgsdtXdiIWIWWHryPT:serer.xywith txnId m1585745259550.4
Error sending event [M_FORBIDDEN: User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)] {
  errcode: 'M_FORBIDDEN',
  name: 'M_FORBIDDEN',
  message: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)",
  data: {
    errcode: 'M_FORBIDDEN',
    error: "User @user:serer.xynot in room !WgsdtXdiIWIWWHryPT:serer.xy(<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)"
  },
  httpStatus: 403
}
sendEvent of type m.room.message in !mmduLZXAAkNrqCWFkZ:serer.xywith txnId m1585745260221.0
Event sent to !mmduLZXAAkNrqCWFkZ:serer.xywith event id $3wTcn5ffmdkjsjk3AUsjbS5mJ4SI8UiOrzaa3XM3v6M
making extra ghosts.. [ 'e:[email protected]', '+00123123123' ]
filtered out myself [ '+00123123123' ]
joined ghost +00123123123

log on synapse-side:

2020-04-01 14:41:16,747 - synapse.rest.media.v1.media_repository - 392 - WARNING - GET-10394 - Not retrying destination 'synapse.keyvan.pw'
2020-04-01 14:41:24,205 - synapse.rest.media.v1.media_repository - 392 - WARNING - GET-10430 - Not retrying destination 'synapse.keyvan.pw'
2020-04-01 14:41:28,099 - synapse.http.matrixfederationclient - 491 - WARNING - federation_transaction_transmission_loop-5610 - {PUT-O-5645} [national-security.agency] Request failed: PUT matrix://national-security.agency/_matrix/federation/v1/send/1585739280635: RequestTransmissionFailed:[Error([('SSL routines', 'ssl3_read_bytes', 'tlsv1 alert protocol version')])]
2020-04-01 14:41:28,104 - synapse.federation.sender.per_destination_queue - 324 - WARNING - federation_transaction_transmission_loop-5610 - TX [national-security.agency] Failed to send transaction: Failed to send request: RequestTransmissionFailed: [<twisted.python.failure.Failure OpenSSL.SSL.Error: [('SSL routines', 'ssl3_read_bytes', 'tlsv1 alert protocol version')]>]
2020-04-01 14:41:33,574 - synapse.http.site - 203 - WARNING - GET-10480 - Error processing request <XForwardedForRequest at 0xae528650 method='GET' uri='/_matrix/client/r0/sync?filter=0&timeout=30000&since=s102614_374014_231_46685_12_8_3904_3644_121' clientproto='HTTP/1.0' site=8008>: <class 'twisted.internet.error.ConnectionDone'> Connection was closed cleanly.
2020-04-01 14:41:34,044 - synapse.handlers.message - 810 - WARNING - POST-10469 - Denying new event <FrozenEventV3 event_id='$bm9K1oi61HyaI4U0A9pbjibI4T3gTSTMOmbAf1jSqnQ', type='m.room.member', state_key='@user:server.xy'> because 403: You are not invited to this room.
2020-04-01 14:41:34,102 - synapse.rest.media.v1.media_repository - 392 - WARNING - GET-10483 - Not retrying destination 'synapse.keyvan.pw'
2020-04-01 14:41:34,582 - synapse.handlers.message - 810 - WARNING - POST-10470 - Denying new event <FrozenEventV3 event_id='$S1bzi5pIlWzZQoe3bbMWcmsusJ1GQHrXq8JOPf7CCkA', type='m.room.member', state_key='@user:server.xy'> because 403: You are not invited to this room.
2020-04-01 14:41:35,640 - synapse.handlers.message - 810 - WARNING - PUT-10486 - Denying new event <FrozenEventV3 event_id='$bBYxwSjKmXIQimz33_oRlGsqtIXM_h173Nz2pK12Fx8', type='m.room.message', state_key='None'> because 403: User @user:server.xy not in room !WgsdtXdiIWIWWHryPT:server.xy (<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)
2020-04-01 14:41:36,692 - synapse.handlers.message - 810 - WARNING - POST-10490 - Denying new event <FrozenEventV3 event_id='$SMw3ChMOFVNLJEWvT8k7JBRw-yLvHh8voyv3FaTwKkU', type='m.room.member', state_key='@user:server.xy'> because 403: You are not invited to this room.
2020-04-01 14:41:38,241 - synapse.http.server - 465 - WARNING - GET-10480 - Not sending response to request <XForwardedForRequest at 0xae528650 method='GET' uri='/_matrix/client/r0/sync?filter=0&timeout=30000&since=s102614_374014_231_46685_12_8_3904_3644_121' clientproto='HTTP/1.0' site=8008>, already disconnected.
2020-04-01 14:41:38,279 - synapse.rest.media.v1.media_repository - 392 - WARNING - GET-10497 - Not retrying destination 'synapse.keyvan.pw'
2020-04-01 14:41:39,322 - synapse.handlers.message - 810 - WARNING - PUT-10498 - Denying new event <FrozenEventV3 event_id='$xiFKWNbJRNrsl2ETLElimCTC7SUlaFVT0LEDcs15EH8', type='m.room.message', state_key='None'> because 403: User @user:server.xy not in room !WgsdtXdiIWIWWHryPT:server.xy (<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)
2020-04-01 14:41:41,093 - synapse.handlers.message - 810 - WARNING - POST-10512 - Denying new event <FrozenEventV3 event_id='$ma6d_NqtIrt_gno7DO4FElQ4HhhSbzdicH445JB1c50', type='m.room.member', state_key='@imessage_=2b41764564645:server.xy'> because 403: @user:server.xy not in room !WgsdtXdiIWIWWHryPT:server.xy.
2020-04-01 14:41:42,944 - synapse.handlers.message - 810 - WARNING - POST-10515 - Denying new event <FrozenEventV3 event_id='$vMXwZvymU-qprVMMEZg9zRoBhgMPwnzZq_Kozm6meMs', type='m.room.member', state_key='@user:server.xy'> because 403: You are not invited to this room.
2020-04-01 14:41:48,603 - synapse.handlers.message - 810 - WARNING - PUT-10548 - Denying new event <FrozenEventV3 event_id='$jd0rU5Ya2Ox6wjs8BeZhmnXRLKzHvn3uBtLJnWo5iSQ', type='m.room.message', state_key='None'> because 403: User @user:server.xy not in room !WgsdtXdiIWIWWHryPT:server.xy (<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)
2020-04-01 14:41:50,209 - synapse.handlers.message - 810 - WARNING - POST-10549 - Denying new event <FrozenEventV3 event_id='$Kf-xWdCf_-yI4JFztZR8gmlsuJ1a3obTzXXVxoHelLA', type='m.room.member', state_key='@user:server.xy'> because 403: You are not invited to this room.
2020-04-01 14:41:51,356 - synapse.handlers.message - 810 - WARNING - POST-10556 - Denying new event <FrozenEventV3 event_id='$3dUDP4NGs4a5wo_issfjHbWu16UsWdlrfat0ulXGJ3c', type='m.room.member', state_key='@user:server.xy'> because 403: You are not invited to this room.
2020-04-01 14:41:54,818 - synapse.handlers.message - 810 - WARNING - PUT-10573 - Denying new event <FrozenEventV3 event_id='$OXosyB42a37CQb8BoR4tQr4dyh9SxCzlpRoK-d7khRY', type='m.room.message', state_key='None'> because 403: User @user:server.xy not in room !WgsdtXdiIWIWWHryPT:server.xy (<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)
2020-04-01 14:41:59,549 - synapse.handlers.message - 810 - WARNING - POST-10589 - Denying new event <FrozenEventV3 event_id='$_3XxxrHd7u5BvRdRtpHT7cjR0_NTht4L6-FbCeLUf3k', type='m.room.member', state_key='@user:server.xy'> because 403: You are not invited to this room.
2020-04-01 14:42:00,400 - synapse.handlers.message - 810 - WARNING - PUT-10602 - Denying new event <FrozenEventV3 event_id='$2wy09d5gsDL0ushBaYrr2GEp_etOOwQnjo8AYikfHz0', type='m.room.message', state_key='None'> because 403: User @user:server.xy not in room !WgsdtXdiIWIWWHryPT:server.xy (<FrozenEventV3 event_id='$IwrhxqEFrRBh03ceIStz4zFjC2gTreLa8tqdtGW5TdE', type='m.room.member', state_key='@user:server.xy'>)
2020-04-01 14:42:05,923 - synapse.http.matrixfederationclient - 491 - WARNING - federation_transaction_transmission_loop-5609 - {PUT-O-5644} [intothecyber.space] Request failed: PUT matrix://intothecyber.space/_matrix/federation/v1/send/1585739280634: TimeoutError('')

(log data has been anonymized)

msgtype: 'm.emote' is unsupported

Error in handleMatrixEvent Error: dont know how to handle this msgtype
    at App._handleMatrixMessageEvent (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1090:11)
    at App.handleMatrixMessageEvent (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1016:25)
    at App.handleMatrixEvent (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1008:19)
    at Bridge._onConsume (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/lib/bridge.js:761:26)
    at tryCatcher (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/util.js:26:23)
    at Promise.successAdapter (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/nodeify.js:23:30)
    at Promise._settlePromiseAt (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/promise.js:582:21)
    at Promise._settlePromises (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/promise.js:700:14)
    at Async._drainQueue (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:15:14)
    at processImmediate (internal/timers.js:439:21) {
  [stack]: 'Error: dont know how to handle this msgtype\n' +
    '    at App._handleMatrixMessageEvent (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1090:11)\n' +
    '    at App.handleMatrixMessageEvent (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1016:25)\n' +
    '    at App.handleMatrixEvent (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-puppet-bridge/src/base.js:1008:19)\n' +
    '    at Bridge._onConsume (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/lib/bridge.js:761:26)\n' +
    '    at tryCatcher (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/util.js:26:23)\n' +
    '    at Promise.successAdapter (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/nodeify.js:23:30)\n' +
    '    at Promise._settlePromiseAt (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/promise.js:582:21)\n' +
    '    at Promise._settlePromises (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/promise.js:700:14)\n' +
    '    at Async._drainQueue (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:123:16)\n' +
    '    at Async._drainQueues (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:133:10)\n' +
    '    at Immediate.Async.drainQueues (/Users/krueger/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/bluebird/js/main/async.js:15:14)\n' +
    '    at processImmediate (internal/timers.js:439:21)',
  [message]: 'dont know how to handle this msgtype'
} {
  age: 228,
  content: {
    body: 'ertränkt sich gleich in der Badewanne! ',
    msgtype: 'm.emote'
  },
  event_id: '$f36fb6mpxx5XY28Qcc98wbI75aAeoq4IxpKvihsP_Po',
  origin_server_ts: 1599924142549,
  room_id: '!AcBEEBTKSRdsdEeeTY:mailstation.de',
  sender: '@philantrop:mailstation.de',
  type: 'm.room.message',
  unsigned: { age: 228 },
  user_id: '@philantrop:mailstation.de'
} 

And, no, I'm not about to drown myself in my bathtub. ;-)

rapid fire causes duplicates

there is a moment in time in which a message has just begun processing, and has not been marked as such (it is marked "skip" at the end of the promise chain), in which the file-changed event may trigger a processing of that very same message. because it is not yet marked "skip", it is also processed.

Handle videos

@imessagebot:dev.matrix.mdks.org

dont know how to deal with filetype { roomId: '[email protected]',
  senderName: '[email protected]',
  senderId: '[email protected]',
  text: 'Lol',
  path: '/Users/keyvan/Library/Messages/Attachments/ed/13/4F26B333-3F77-48DB-912A-C47B1E12FF7F/IMG_2485.MOV.mov',
  mimetype: 'video/quicktime' } 

MacOS Big Sur support

I upgraded to big sur without realizing that the location of the com.apple folder was not the same... is there any way to fix this issue or is an update planned in the works?

Roomservice is reset to SMS after restart

After restarting the bridge by default all messages will be sent via SMS. For users of the birdge without SMS flatrate this could be expensive.

We should have a persistent storage for the roomservice that survives a restart of the bridge...

URLs cause duplicates

When you send a URL to a contact the message will disappear twice in your sent messages.

This issue could also be related to ichat2json by not detecting this message as your own.

Support HEIF images

These days, everybody is on iOS 11, and is thus probably sending messages in HEIF format rather than jpeg/png.

This means that image support in this bridge is largely broken at the moment. Unless there's some level of support in riot for displaying HEIF (I don't think so?), we'll need to convert the HEIF images to jpeg or png and attach those.

Forward images from iMessage->Matrix

Currently we forward that there is "1 attachment"

We already have the filepath to the image at that point, we just need to implement and use a base method that will upload an image-type message from the point of view of the ghost user.

Once this is done, there will be a deduplication issue to deal with ... we can't "tag" images the way we can text... But we can cross that road when we get there. I think @AndrewJDR had some kind of solution to this, but I can't remember what it was.

body not in content error

the retry logic accumulates with crap every time we get an image without text. if you run the bridge for awhile, get a bunch of image messages, and come back, you will see your logs scrolling rapidly. need to handle these messages

Encryption Support

Any chance of supporting room encryption? Overall this works amazingly well.

Using the chat sqlite database

When messages are sent and received on a Mac, there is a Sqlite database that is updated along with the archive files.

All of this info was accurate for Mac OS X 10.12. Things could be different in different OS X versions

The chat database is located at ~/Library/Messages/chat.db

The database provides seven tables: message, attachment, message_attachment_join, handle, chat, chat_handle_join, chat_message_join

Message

The message table provides all of the info specific to a single message.

message table schema:


CREATE TABLE message (
	ROWID INTEGER PRIMARY KEY AUTOINCREMENT,
	guid TEXT UNIQUE NOT NULL,
	text TEXT,
	replace INTEGER DEFAULT 0,
	service_center TEXT,
	handle_id INTEGER DEFAULT 0,
	subject TEXT,
	country TEXT,
	attributedBody BLOB,
	version INTEGER DEFAULT 0,
	type INTEGER DEFAULT 0,
	service TEXT,
	account TEXT,
	account_guid TEXT,
	error INTEGER DEFAULT 0,
	date INTEGER,
	date_read INTEGER,
	date_delivered INTEGER,
	is_delivered INTEGER DEFAULT 0,
	is_finished INTEGER DEFAULT 0,
	is_emote INTEGER DEFAULT 0,
	is_from_me INTEGER DEFAULT 0,
	is_empty INTEGER DEFAULT 0,
	is_delayed INTEGER DEFAULT 0,
	is_auto_reply INTEGER DEFAULT 0,
	is_prepared INTEGER DEFAULT 0,
	is_read INTEGER DEFAULT 0,
	is_system_message INTEGER DEFAULT 0,
	is_sent INTEGER DEFAULT 0,
	has_dd_results INTEGER DEFAULT 0,
	is_service_message INTEGER DEFAULT 0,
	is_forward INTEGER DEFAULT 0,
	was_downgraded INTEGER DEFAULT 0,
	is_archive INTEGER DEFAULT 0,
	cache_has_attachments INTEGER DEFAULT 0,
	cache_roomnames TEXT,
	was_data_detected INTEGER DEFAULT 0,
	was_deduplicated INTEGER DEFAULT 0,
	is_audio_message INTEGER DEFAULT 0,
	is_played INTEGER DEFAULT 0,
	date_played INTEGER,
	item_type INTEGER DEFAULT 0,
	other_handle INTEGER DEFAULT 0,
	group_title TEXT,
	group_action_type INTEGER DEFAULT 0,
	share_status INTEGER DEFAULT 0,
	share_direction INTEGER DEFAULT 0,
	is_expirable INTEGER DEFAULT 0,
	expire_state INTEGER DEFAULT 0,
	message_action_type INTEGER DEFAULT 0,
	message_source INTEGER DEFAULT 0,
	associated_message_guid TEXT,
	associated_message_type INTEGER DEFAULT 0,
	balloon_bundle_id TEXT,
	payload_data BLOB,
	expressive_send_style_id TEXT,
	associated_message_range_location INTEGER DEFAULT 0,
	associated_message_range_length INTEGER DEFAULT 0,
	time_expressive_send_played INTEGER,
	message_summary_info BLOB
);

Attachment

The attachment table provides information about a file that was attached to a message.

attachment table schema:

CREATE TABLE attachment (
	ROWID INTEGER PRIMARY KEY AUTOINCREMENT,
	guid TEXT UNIQUE NOT NULL,
	created_date INTEGER DEFAULT 0,
	start_date INTEGER DEFAULT 0,
	filename TEXT,
	uti TEXT,
	mime_type TEXT,
	transfer_state INTEGER DEFAULT 0,
	is_outgoing INTEGER DEFAULT 0,
	user_info BLOB,
	transfer_name TEXT,
	total_bytes INTEGER DEFAULT 0,
	is_sticker INTEGER DEFAULT 0,
	sticker_user_info BLOB,
	attribution_info BLOB,
	hide_attachment INTEGER DEFAULT 0
);

Message / Attachment join

The message_attachment_join table is used to create a relationship between messages and attachments. Rows in this table have a message_id and an attachment_id. Both of these fields correspond the a ROWID in their respective tables.

message_attachment_join table schema:

CREATE TABLE message_attachment_join (
	message_id INTEGER REFERENCES message (ROWID) ON DELETE CASCADE,
	attachment_id INTEGER REFERENCES attachment (ROWID) ON DELETE CASCADE,
	UNIQUE(
		message_id,
		attachment_id
	)
);

Handle

The handle table provides information for each iMessage user that has a message stored in the message table

handle table schema:

CREATE TABLE handle (
	ROWID INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
	id TEXT NOT NULL,
	country TEXT,
	service TEXT NOT NULL,
	uncanonicalized_id TEXT,
	UNIQUE (
		id,
		service
	)
);

Chat

The chat table provides some information about a room that messages are sent in.

chat table schema:

CREATE TABLE chat (
	ROWID INTEGER PRIMARY KEY AUTOINCREMENT,
	guid TEXT UNIQUE NOT NULL,
	style INTEGER,
	state INTEGER,
	account_id TEXT,
	properties BLOB,
	chat_identifier TEXT,
	service_name TEXT,
	room_name TEXT,
	account_login TEXT,
	is_archived INTEGER DEFAULT 0,
	last_addressed_handle TEXT,
	display_name TEXT,
	group_id TEXT,
	is_filtered INTEGER,
	successful_query INTEGER
);

Chat / Handle join

The chat_handle_join table is used to create a relationship between the chat and handle tables. Similar to the other join tables, the rows in this table connect a ROWID in the chat table to a ROWID in the handle table.

Each row in this table signifies that a specific iMessage user is in a specific chat.

chat_handle_join table schema:

CREATE TABLE chat_handle_join (
	chat_id INTEGER REFERENCES chat (ROWID) ON DELETE CASCADE,
	handle_id INTEGER REFERENCES handle (ROWID) ON DELETE CASCADE,
	UNIQUE (
		chat_id,
		handle_id
	)
);

Chat / Message join

The chat_message_join table is used to create a relationship between the chat and message tables. Similar to the other join tables, the rows in this table connect a ROWID in the chat table to a ROWID in the message table.

Each row in this table signifies that a specific message belongs to a specific chat.

chat_message_join table schema:

CREATE TABLE chat_message_join (
	chat_id INTEGER REFERENCES chat (ROWID) ON DELETE CASCADE,
	message_id INTEGER REFERENCES message (ROWID) ON DELETE CASCADE,
	PRIMARY KEY (
		chat_id,
		message_id
	)
);

No incoming messages received

On Mojave point release .6 and Matrix Synapse latest-py3 as of today (from Dockerhub)... I don't receive iMessages from others, but they can get my messages. This is a Matrix side problem, not an iMessage side problem.

Unhandled rejection Error: Failed to join room
    at /Users/sean/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/lib/components/intent.js:725:53
    at tryCatcher (/Users/sean/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/matrix-js-sdk/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/sean/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/matrix-js-sdk/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/Users/sean/matrix-puppet-imessage/node_modules/matrix-appservice-bridge/node_modules/matrix-js-sdk/node_modules/bluebird/js/release/promise.js:604:18)

The UI symptom: in Riot, the third party's "user" who would join the DM room with me, never actually joins the room. The iMessage bot leaves the room shortly after it's created.

Oddly, when I message myself, it works in both directions.

Grouping in a community

Would it be possible to put all rooms/private messages from iMessage in a community of it its own? Would help to keep everything organized by placing everything related to iMessage bunched up together.

I've seen a couple of puppet bridges do this already. (e.g. WhatsApp)

images need to come through or at least show as a notice

depending on who your friends are, images can convey quite a bit of information and really need to be supported.

i woudl say the same about videos and voice.

let us set some time aside and handle all these; at the very least a notice should happen from the ghost (needs to do push notification) to let us know about it.

Read receipts

I tend to use the iMessage client and riot clients interchangeably a lot. I will "read" messages on my phone using iOS for example, and then login to Riot later in the day and see a lot of "unread"

Goal 1: iMessage -> Matrix

  • Isn't it true that the "read status" (iMessage Read Receipt) gets updated in the transcript file?

If so, we can relay this information to the Matrix side.

Goal 2: Matrix -> iMessage

  • Isn't it true that opening the relevant conversation in iMessage via AppleScript "reads" conversation?

If so, we can relay Matrix read receipts to the iOS side

Messages in Group Chats Not Sent

I am able to receive group messages but not reply. Single person to person messages work as expected. This occurred with two separate group messages with all users using imessage not mms. The below error shows up in Terminal. Thanks for any help you provide!

MacOS: 10.13.6

full applescript tell application "Messages"
    activate
    set budy0 to first buddy whose handle is "=2b<FIRSTNUMBER>"
        set buddy1 to first buddy whose handle is "=2b1<SECONDNUMBER>"
    set thisChat to make new text chat with properties {participants:{buddy0,buddy1}}
    send "<MESSAGE CONTENT> " to thisChat
  end tell
59:103: execution error: Messages got an error: Can't get buddy 1 whose handle =  "=2b<FIRSTNUMBER>". Invalid index. (-1719)
sendEvent of type m.room.message in !<ROOM>:website.net with m1234567890123.1
Event set to !<ROOM>:website.net with event id $<EVENTID>
Error in handleMatrixEvent { Error: exited nonzero
    at ChildProcess. (/Users/USERNAME/matrix-puppet-imessage/src/imessage-send-group.js:49:18)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
  [stack]:
   'Error: exited nonzero\n    at ChildProcess. (/Users/USERNAME/matrix-puppet-imessage/src/imessage-send-group.js:49:18)\n    at ChildProcess.emit (events.js:198:13)\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)',
  [message]: 'exited nonzero' } { age: 33,
  content:
   { body:
      'MESSAGE',
     msgtype: 'm.text' },
  event_id: '$kvKsRcxp8W44kwn_W5BwElx4F9fjPsDbkWkNH_aJLQ',
  origin_server_ts: 1111111111111,
  room_id: '!VEdCCGuqmEccwednBS:hostname.net',
  sender: '@<username>:hostname.net',
  type: 'm.room.message',
  unsigned: { age: 33 },
  user_id: '@<username>:hostname.net',
  getRoomId: { [Function] [length]: 0, [name]: '' },
  getId: { [Function] [length]: 0, [name]: '' } } 

"Failed to join room" against Synapse 1.12.0

Last night I began the process of moving my homeserver off my media server to a new server dedicated to various cloud applications (so the media server can dedicate all its resources to transcoding). This meant getting my lovely iMessage bridge moved as well.

I ended up in a situation where I could receive but not send messages. After many frustrating hours of debugging, I realized my new homeserver installation was of course using the latest version (1.12.0 as of this writing), while the previous installation which had been working was on 1.9.1. So I rolled back to 1.9.1, started everything from scratch, and now I'm back in business.

Here's the error I see (phone number edited out) when running against 1.12.0: failed to join ghost +XXXXXXXXXXX Error: Failed to join room.

I don't know which precise Synapse version breaks it, only that 1.9.1 works and 1.12.0 doesn't. It's possible the issue isn't in the iMessage bridge itself, but in the underlying library it uses to connect with Matrix.

run imessage in the background or control it with cli

I am running my homeserver on a linux device and using puppet-imessage on my osx-desktop device. This setup is working ok so far but it still annoys me, that imessage keeps popping up when i get a new message or send one from riot-client. Is there a way to prevent imessage gui from starting up?
Another, maybe more elegant solution would be to integrate https://textbelt.com as an sms-server directly on the linux-device where the homeserver is hosted and integrate it with synapse. I think that not many people run an osx-server ,so this would probably be a suitable addition to the mac-users running a matrix-homeserver on linux.

cheers
bendsch

Message Reactions

Reactions from iMessage -> Matrix and from Matrix -> iMessage are currently unsupported.

I've done some digging and (to my limited knowledge) it seems like reactions aren't stored in the transcript files.
Running a "date -r" command on the .ichat file, reacting to a message in iMessage and then running "date -r" on the .ichat file again shows that the file was not modified like it would be if a user sent a new iMessage.
I used plutil to convert a transcript file to xml and did some digging manually and didn't find any reference to reactions that way either.

Digging around in the ichat.db, I found that reactions are stored in there.
The ichat db stores reactions as their own row in the "message" table. There are two field that are particularly useful associated_message_guid and associated_message_type. associated_message_type is the message that was reacted to and associated_message_type is a numeric value representing the reaction.

reaction associated_message_type
love 2000
like 2001
dislike 2002
laugh 2003
emphasize 2004
question 2005

Essentially, adding functionality for reactions requires using the ichat database instead of using transcript files. Is there any technical limitations of using the ichat database?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.