Пример #1
0
 def _process(self):
     # Blocking receive indefinitely
     msg = self._receive(True)
     if msg: # Check whether the message arrived
         msgNote = serializer.deserialize(msg.content)
         print msgNote
         #msgManager.addMsg(msgNote)
     else:
         print "No msg"
Пример #2
0
 def _process(self):
     # Blocking receive indefinitely
     msg = self._receive(True)
     if msg: # Check whether the message arrived
         msgNote = serializer.deserialize(msg.content)
         print "updated msg arrived, =", msgNote
         #self.myAgent.msgManager.add_msg_to_sender(msgNote, state=msgNote.state)
         username = msg.sender.getName().split("@")[0]
         self.myAgent.msgManager.add_msg_to_users(msgNote, [username],state=msgNote.state)
     else:
         print "No msg"
Пример #3
0
 def _process(self):
     # Blocking receive indefinitely
     msg = self._receive(True)
     if msg: # Check whether the message arrived
         msgNote = serializer.deserialize(msg.content)
         print "new msg arrived, =", msgNote
         self.myAgent.msgManager.add_msg_to_sender(msgNote, state=MsgState.SENT)
         print msgNote.recipients
         recipients = self.myAgent.groups.getUsersForGroupsAndUsers(msgNote.recipients)
         self.myAgent.msgManager.add_msg_to_users(msgNote, recipients, state=MsgState.NEW)
         #self.myAgent.msgManager.add_msg_to_users(msgNote, msgNote.recipients, state=MsgState.NEW)
         msgNote.state = MsgState.NEW
         self.myAgent.sendMsg(msgNote, recipients) # TODO
     else:
         print "No msg"
Пример #4
0
    def _process(self):
        # Blocking receive indefinitely
        msg = self._receive(True)
        if msg: # Check whether the message arrived
            msgNote = serializer.deserialize(msg.content)
            print msgNote
            self.myAgent.peaClient.agentUpdated([msgNote])
            
# these lines were added to check, if updating msg on server works correctly
# at the time it worked, so if nothing changes the code can be used to update message state
#            msgNote.state = MsgState.READ 
#            self.myAgent.updateMsg(msgNote)

# it is the right place to do sth with the message - either add it to msgBox, or execute some listener
# with msgNote as parameter
#            self.myAgent.msgBox.addMsg(...)
        else:
            print "No msg"