diff --git a/python/IPO/receive.py b/python/IPO/receive.py index 2a48fc16f..f172905a3 100644 --- a/python/IPO/receive.py +++ b/python/IPO/receive.py @@ -8,37 +8,36 @@ opened, check the player's mail and create objects if necessary. import Crossfire import CFMail -activator=Crossfire.WhoIsActivator() -activatorname=activator.Name -whoami=Crossfire.WhoAmI() - +activator = Crossfire.WhoIsActivator() mail = CFMail.CFMail() -total = mail.countmail(activatorname) +whoami = Crossfire.WhoAmI() + +total = mail.countmail(activator.Name) if total > 0: - activator.Write("You have %d mail!" % total) - elements = mail.receive(activatorname) - for element in elements: - type, fromname, message = element - if type==1: - msgob = whoami.CreateObject('scroll') - msgob.Name='mail F: '+fromname+' T: '+activatorname - msgob.NamePl=msgob.Name - msgob.Message=message - msgob.Value=0 - elif type==2: - msgob = whoami.CreateObject('note') - msgob.Name='newspaper D: '+fromname - msgob.NamePl='newspapers D: '+fromname - msgob.Message=message - msgob.Value=0 - elif type==3: - msgob = whoami.CreateObject('diploma') - msgob.Name='mailwarning F: '+fromname+' T: '+activatorname - msgob.NamePl='mailwarnings F: '+fromname+' T: '+activatorname - msgob.Message=message - msgob.Value=0 - else: - Crossfire.Log(Crossfire.LogError, 'ERROR: unknown mailtype\n') + activator.Write("You have %d mail!" % total) + elements = mail.receive(activator.Name) + for element in elements: + type, fromname, message = element + if type == 1: + msgob = whoami.CreateObject('scroll') + msgob.Name = "mail F: %s T: %s" % (fromname, activator.Name) + msgob.NamePl = msgob.Name + msgob.Message = message + msgob.Value = 0 + elif type == 2: + msgob = whoami.CreateObject('note') + msgob.Name = 'newspaper D: '+fromname + msgob.NamePl = 'newspapers D: '+fromname + msgob.Message = message + msgob.Value = 0 + elif type == 3: + msgob = whoami.CreateObject('diploma') + msgob.Name = 'warning F: '+fromname+' T: '+activator.Name + msgob.NamePl = 'warnings F: '+fromname+' T: '+activator.Name + msgob.Message = message + msgob.Value = 0 + else: + Crossfire.Log(Crossfire.LogError, 'ERROR: unknown mailtype\n') else: - activator.Write("You haven't got any mail.") + activator.Write("You haven't got any mail.")