diff --git a/README.md b/README.md index e13c3b0..43ea6b4 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,13 @@ Copy `config.sample.json` to `config.json` and update it to match your setup ## register the app service -Generate a yaml file with `node index.js -r -u "https://your.matrix.homeserver"` +Generate an `imessage-registration.yaml` file with `node index.js -r -u "https://your.matrix.homeserver"` -Update `app_service_config_files` with the path to this yaml file. +Note: The 'registration' setting in the config.json needs to the path to this file. By default, it already is. + +Copy this `imessage-registration.yaml` file to your home server, then edit it, setting its url to point to your bridge server. e.g. `url: 'http://your-bridge-server.example.org:8090'` + +Edit your homeserver.yaml file and update the `app_service_config_files` with the path to the `imessage-registration.yaml` file. # TODO diff --git a/bridge.js b/bridge.js index 639f25f..d54dee6 100644 --- a/bridge.js +++ b/bridge.js @@ -80,12 +80,17 @@ new Cli({ module.exports = function() { this.init = () => storage.init(); - this.handleIncoming = (msg, markSent) => { + this.handleIncoming = (msg, markSent, fileRecipient) => { return new Promise(function(resolve, reject) { if (msg.isNotMe) { console.log('handling incoming message from apple', msg); const ghost = "@imessage_"+msg.sender+":"+config.bridge.domain; let intent = bridge.getIntent(ghost); + if(fileRecipient) + { + intent.setDisplayName(fileRecipient + " (iMsg)"); + } + return storage.getItem(ghost).then((meta) => { if (meta && meta.room_id) { console.log('found room', meta); diff --git a/index.js b/index.js index 46699c3..2ac8ce9 100644 --- a/index.js +++ b/index.js @@ -62,7 +62,12 @@ storage.init().then(function() { var parts = filepath.split(path.sep); var len = parts.length; let [ dateString ] = parts.slice(len-2, len-1); + var filename = parts[len-1]; + let [ fileRecipient ] = filename.split(" on "); + //console.log("File recipient: " + fileRecipient); + var today = moment().format('YYYY-MM-DD') + if ( ready ) { // go thru each msg, if skip noop, else relay+skip TR(filepath).getMessages().map(msg => { @@ -74,7 +79,7 @@ storage.init().then(function() { //console.log('########## marking skip: ', hash, sender, message); return storage.setItem(hash, {skip: true}); } - return bridge.handleIncoming(msg, markSkip(msg)) + return bridge.handleIncoming(msg, markSkip(msg), fileRecipient) } }) }).catch(err=>console.error(err))