|
@@ -808,18 +808,37 @@ def ffpb_nodemesh(bot, trigger):
|
|
|
|
|
|
# filter out duplicate names
|
|
|
neighbours = set()
|
|
|
+ gateways = set()
|
|
|
for line in req:
|
|
|
ident, name = line.strip().split('=')
|
|
|
- neighbours.add(name)
|
|
|
+ if ident == name and ident.startswith('c0:ff:ee:ba:be:'):
|
|
|
+ gateways.add('Gateway ' + ident[len('c0:ff:ee:ba:be:'):])
|
|
|
+ else:
|
|
|
+ neighbours.add(name)
|
|
|
neighbours = [x for x in neighbours]
|
|
|
+ gateways = sorted([x for x in gateways])
|
|
|
|
|
|
# respond to the user
|
|
|
+ reply = node['hostname']
|
|
|
if len(neighbours) == 0:
|
|
|
- bot.say(u'{0} hat keinen Mesh-Partner *schnüff*'.format(node['hostname']))
|
|
|
+ reply += ' hat keinen Mesh-Partner'
|
|
|
elif len(neighbours) == 1:
|
|
|
- bot.say(u'{0} mesht mit \'{1}\''.format(node['hostname'], neighbours[0]))
|
|
|
+ reply += u' mesht mit \'{0}\''.format(neighbours[0])
|
|
|
else:
|
|
|
- bot.say('{0} mesht mit \'{1}\' und \'{2}\''.format(node['hostname'], '\', \''.join(neighbours[:-1]), neighbours[-1]))
|
|
|
+ reply += ' mesht mit \'{0}\' und \'{1}\''.format('\', \''.join(neighbours[:-1]), neighbours[-1])
|
|
|
+
|
|
|
+ if len(gateways) > 0:
|
|
|
+ if len(neighbours) == 0:
|
|
|
+ reply += ', aber hat eine Verbindung zu '
|
|
|
+ else:
|
|
|
+ reply += ' und hat zudem eine Verbindung zu '
|
|
|
+
|
|
|
+ if len(gateways) == 1:
|
|
|
+ reply += gateways[0]
|
|
|
+ else:
|
|
|
+ reply += '{0} und {1}'.format('\', \''.join(gateways[:-1]), gateways[-1])
|
|
|
+
|
|
|
+ bot.say(reply)
|
|
|
|
|
|
@willie.module.commands('exec-on-peer')
|
|
|
def ffpb_remoteexec(bot, trigger):
|