diff --git a/modules/report/report.js b/modules/report/report.js index 3b60720..5b18099 100644 --- a/modules/report/report.js +++ b/modules/report/report.js @@ -207,6 +207,20 @@ var report = function(dbot) { this.db.save('notifies', notify.id, notify, function() {}); }.bind(this), function() {}); }.bind(this)); + + dbot.api.event.addHook('new_current_nick', function(user) { + if(_.has(this.pending, user.id) && this.pNotify[user.id] === true + && !_.include(user.mobile, user.currentNick)) { + dbot.say(user.server, user.currentNick, dbot.t('missed_notifies', { + 'user': user.primaryNick, + 'link': dbot.api.web.getUrl('notify/' + user.server + '/missing') + })); + this.pNotify[user.id] = false; + } + + }.bind(this)); + + }.bind(this); }; diff --git a/modules/users/users.js b/modules/users/users.js index 78ee8ac..1346f60 100644 --- a/modules/users/users.js +++ b/modules/users/users.js @@ -22,7 +22,8 @@ var users = function(dbot) { 'currentNick': nick, 'server': server, 'channels': [], - 'aliases': [] + 'aliases': [], + 'mobile': [] }, function(err, result) { if(!err) { dbot.api.event.emit('new_user', [ result ]); @@ -96,6 +97,7 @@ var users = function(dbot) { this.listener = function(event) { this.api.isKnownUser(event.server, event.newNick, function(isKnown) { event.rUser.currentNick = event.newNick; + dbot.api.event.emit('new_current_nick', [ event.rUser ]); if(!isKnown) { event.rUser.aliases.push(event.newNick); @@ -133,7 +135,10 @@ var users = function(dbot) { } else { if(event.user != user.currentNick) { user.currentNick = event.user; - this.db.save('users', user.id, user, function() { done(user); }); + this.db.save('users', user.id, user, function() { + dbot.api.event.emit('new_current_nick', [ user ]); + done(user); + }); } else { done(user); }