mirror of
https://github.com/evennia/evennia.git
synced 2026-04-03 06:27:17 +02:00
In the strange case where someone creates two mappings with the same IMC2 name, handle it gracefully by emitting to all matching mappings instead of just assuming there'll only be one match.
This commit is contained in:
parent
9b8f1cf3ea
commit
45f17f6732
1 changed files with 4 additions and 3 deletions
|
|
@ -116,14 +116,15 @@ class IMC2Protocol(StatefulTelnetProtocol):
|
|||
chan_name = chan_name.split(':', 1)[1]
|
||||
try:
|
||||
# Look for matching IMC2 channel maps.
|
||||
mapping = IMC2ChannelMapping.objects.get(imc2_channel_name=chan_name)
|
||||
mappings = IMC2ChannelMapping.objects.filter(imc2_channel_name=chan_name)
|
||||
# Format the message to cemit to the local channel.
|
||||
message = '%s@%s: %s' % (packet.sender,
|
||||
packet.origin,
|
||||
packet.optional_data.get('text'))
|
||||
# Bombs away.
|
||||
if mapping.channel:
|
||||
comsys.send_cmessage(mapping.channel, message)
|
||||
for mapping in mappings:
|
||||
if mapping.channel:
|
||||
comsys.send_cmessage(mapping.channel, message)
|
||||
except IMC2ChannelMapping.DoesNotExist:
|
||||
# No channel mapping found for this message, ignore it.
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue