Changes between Initial Version and Version 1 of Ticket #3548, comment 2


Ignore:
Timestamp:
Oct 25, 2015, 1:20:42 PM (9 years ago)
Author:
elexis

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3548, comment 2

    initial v1  
    1 According to leper the easiest way to do this is to remove the game when the hosting player leaves the lobby (i.e. being banned). Could be something like that:
     1The game should already be removed when the player leaves, according to the code:
    22{{{
    3 Index: source/tools/XpartaMuPP/XpartaMuPP.py
    4 ===================================================================
    5 --- source/tools/XpartaMuPP/XpartaMuPP.py       (revision 17144)
    6 +++ source/tools/XpartaMuPP/XpartaMuPP.py       (working copy)
    7 @@ -577,10 +577,17 @@ class XpartaMuPP(sleekxmpp.ClientXMPP):
    8            break
    9        # Remove them from the local player list.
    10        self.lastLeft = str(presence['muc']['jid'])
    11        if str(presence['muc']['jid']) in self.nicks:
    12          del self.nicks[str(presence['muc']['jid'])]
    13 +      # Try removing the game
    14 +      try:
    15 +        self.gameList.removeGame(presence['muc']['jid'])
    16 +        self.sendGameList()
    17 +      except:
    18 +        traceback.print_exc()
    19 +        logging.error("Failed to process game unregistration data")
    20  
    21    def muc_message(self, msg):
    22      """
    23      Process new messages from the chatroom.
    24      """
     3  def muc_offline(self, presence):
     4    """
     5    Process presence stanza from a chat room.
     6    """
     7    # Clean up after a player leaves
     8    if presence['muc']['nick'] != self.nick:
     9      # Delete any games they were hosting.
     10      for JID in self.gameList.getAllGames():
     11        if JID == str(presence['muc']['jid']):
     12          self.gameList.removeGame(JID)
     13          self.sendGameList()
     14          break
     15      # Remove them from the local player list.
     16      self.lastLeft = str(presence['muc']['jid'])
     17      if str(presence['muc']['jid']) in self.nicks:
     18        del self.nicks[str(presence['muc']['jid'])]
    2519}}}
    26 
    27 Not tested.