Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update readme and display name update #2

Merged
merged 2 commits into from
Dec 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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))
Expand Down