forked from vxmppb/vxmppb
Adding subscription back as it will only accept ones from [friends] in config.ini
This commit is contained in:
parent
7f6cbd36a0
commit
9b41de2e51
17
index.js
17
index.js
|
@ -115,7 +115,7 @@ try {
|
||||||
xmpp.send(user_jid, "[ONLINE]", false);
|
xmpp.send(user_jid, "[ONLINE]", false);
|
||||||
// send mqtt online message
|
// send mqtt online message
|
||||||
client.publish(mqtt_topic, mqtt_message);
|
client.publish(mqtt_topic, mqtt_message);
|
||||||
// toot online message
|
// toot online message
|
||||||
M.post('statuses', {
|
M.post('statuses', {
|
||||||
status: `${mastodon_toot}`
|
status: `${mastodon_toot}`
|
||||||
});
|
});
|
||||||
|
@ -606,6 +606,21 @@ try {
|
||||||
host: bot_hostname,
|
host: bot_hostname,
|
||||||
port: bot_port
|
port: bot_port
|
||||||
});
|
});
|
||||||
|
// subscribe to friends
|
||||||
|
xmpp.on('subscribe', function(from) {
|
||||||
|
if (from in config.friends == true) {
|
||||||
|
console.log('accepting subsciption request from ' + from);
|
||||||
|
// accept pending subscription requests
|
||||||
|
xmpp.acceptSubscription(from);
|
||||||
|
// check for incoming subscription requests
|
||||||
|
xmpp.getRoster();
|
||||||
|
// subscribe to any incoming subscription requests
|
||||||
|
console.log('requesting subscription to ' + from);
|
||||||
|
xmpp.subscribe(from);
|
||||||
|
} else {
|
||||||
|
console.log('denied subscription request from: ' + from + " as they are not in the friends section of config.ini");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Please create a config.ini");
|
console.log("Please create a config.ini");
|
||||||
|
|
Reference in New Issue
Block a user