Esempio n. 1
0
def grab(conversation, id):
  id = int(id)
  issue = Issue.byID(id)

  if not issue:
    conversation.say("There is no issue with the ID %d" % id)
  elif not issue.hasSOP:
    conversation.say("Unfortunately that issue doesn't have an SOP associated with it. "
                     "All I can do is describe the problem to you and wait for you to "
                     "<b>resolve<b> it manually")
    conversation.say(issue.description)
    contextSummary = '\n'.join("%s: %s" % info for info in issue.context.data.items())
    conversation.say(contextSummary, useHTML=False)
  else:
    existingAgent = issue.context['agent']

    if existingAgent:
      if existingAgent.conversation is conversation:
        conversation.say("You are already troubleshooting this issue!")
        return
      existingAgent.conversation.say("<b>%s has taken over this issue.</b>" % conversation.buddyName)
      existingAgent.currentIssue = None
      existingAgent.conversation.nevermind()

    conversation.say("Ok, I am assigning issue #%d to you." % id)
    agent = SupportAgent(conversation.buddy)
    #Make sure the agent is available first
    agent.ready = True
    agent.currentIssue = None
    agent.conversation.nevermind()

    agent.engage(issue)
Esempio n. 2
0
def announce(conversation, message):
  agent = SupportAgent( conversation.buddy )
  message = "<b>Announcement from %s</b> ::: %s" % (agent.name, message)
  told = 0
  for team in agent.teams:
    for otherAgent in team.agents:
      if otherAgent is agent: continue
      otherAgent.tell(message)
      told += 1
  if told:
    agent.tell('Your announcement has been sent to your %d team mates' % told)
  else:
    agent.tell('You do not have any team mates.')
Esempio n. 3
0
    def assign(self, who):
        if isinstance(who, str):
            if Team.exists(who):
                who = Team(who)
            elif Conversation.byName(
                    who):  #byName handles short usernames as well as full JIDs
                who = SupportAgent(Conversation.byName(who).buddy)
            else:
                raise ValueError(
                    "I don't know any teams or people named \"%s\"" % who)

        if not isinstance(who, (Team, SupportAgent)):
            raise TypeError(
                "You can only assign issues to Teams or SupportAgents")

        self.assignedTo = who

        if isinstance(who, SupportAgent) and who.available:
            who.engage(self)
Esempio n. 4
0
def announce(conversation, message):
    agent = SupportAgent(conversation.buddy)
    message = "<b>Announcement from %s</b> ::: %s" % (agent.name, message)
    told = 0
    for team in agent.teams:
        for otherAgent in team.agents:
            if otherAgent is agent: continue
            otherAgent.tell(message)
            told += 1
    if told:
        agent.tell('Your announcement has been sent to your %d team mates' %
                   told)
    else:
        agent.tell('You do not have any team mates.')
Esempio n. 5
0
def grab(conversation, id):
    id = int(id)
    issue = Issue.byID(id)

    if not issue:
        conversation.say("There is no issue with the ID %d" % id)
    elif not issue.hasSOP:
        conversation.say(
            "Unfortunately that issue doesn't have an SOP associated with it. "
            "All I can do is describe the problem to you and wait for you to "
            "<b>resolve<b> it manually")
        conversation.say(issue.description)
        contextSummary = '\n'.join("%s: %s" % info
                                   for info in issue.context.data.items())
        conversation.say(contextSummary, useHTML=False)
    else:
        existingAgent = issue.context['agent']

        if existingAgent:
            if existingAgent.conversation is conversation:
                conversation.say("You are already troubleshooting this issue!")
                return
            existingAgent.conversation.say(
                "<b>%s has taken over this issue.</b>" %
                conversation.buddyName)
            existingAgent.currentIssue = None
            existingAgent.conversation.nevermind()

        conversation.say("Ok, I am assigning issue #%d to you." % id)
        agent = SupportAgent(conversation.buddy)
        #Make sure the agent is available first
        agent.ready = True
        agent.currentIssue = None
        agent.conversation.nevermind()

        agent.engage(issue)
Esempio n. 6
0
def free(conversation):
    agent = SupportAgent(conversation.buddy)
    agent.ready = True
    conversation.say("Ok, I will bug you with support issues.")
Esempio n. 7
0
def busy(conversation):
    agent = SupportAgent(conversation.buddy)
    agent.ready = False
    conversation.say("Ok I won't bug you with support issues.")
Esempio n. 8
0
def free(conversation):
  agent = SupportAgent( conversation.buddy )
  agent.ready = True
  conversation.say("Ok, I will bug you with support issues.")
Esempio n. 9
0
def busy(conversation):
  agent = SupportAgent( conversation.buddy )
  agent.ready = False
  conversation.say("Ok I won't bug you with support issues.")
Esempio n. 10
0
 def get_agent(self):
     if SupportAgent.exists(self.conversation.buddy):
         return SupportAgent(self.conversation.buddy)