diff frontends/quick_frontend/quick_app.py @ 125:8d611eb9ae48

primitivus: contact list enhancement - primitivus: contact list now display groups and sexy name (instead of bare jid) - primitivus: contact list now show an alert when somebody want to contact you, and its chat window is not on the screen - primitivus: cursor is now visible when going to chat window (useful to go back in logs)
author Goffi <goffi@goffi.org>
date Mon, 12 Jul 2010 17:50:00 +0800
parents 961e0898271f
children a86607e5cf38
line wrap: on
line diff
--- a/frontends/quick_frontend/quick_app.py	Thu Jul 08 19:47:54 2010 +0800
+++ b/frontends/quick_frontend/quick_app.py	Mon Jul 12 17:50:00 2010 +0800
@@ -67,7 +67,7 @@
         self.current_action_ids = set()
         self.current_action_ids_cb = {}
     
-    def __check_profile(self, profile):
+    def check_profile(self, profile):
         """Tell if the profile is currently followed by the application"""
         return profile in self.profiles.keys()
 
@@ -160,7 +160,7 @@
 
     def connected(self, profile):
         """called when the connection is made"""
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug(_("Connected"))
         self.setStatusOnline(True)
@@ -169,7 +169,7 @@
 
     def disconnected(self, profile):
         """called when the connection is closed"""
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug(_("Disconnected"))
         self.CM.clear()
@@ -177,13 +177,13 @@
         self.setStatusOnline(False)
     
     def newContact(self, JabberId, attributes, groups, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         entity=JID(JabberId)
         self.rosterList[entity.short]=(dict(attributes), list(groups))
     
     def newMessage(self, from_jid, msg, type, to_jid, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         sender=JID(from_jid)
         addr=JID(to_jid)
@@ -196,7 +196,7 @@
         pass
 
     def presenceUpdate(self, jabber_id, show, priority, statuses, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug (_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") % {'jid':jabber_id, 'show':show, 'priority':priority, 'statuses':statuses, 'profile':profile});
         from_jid=JID(jabber_id)
@@ -242,7 +242,7 @@
     
     def roomJoined(self, room_id, room_service, room_nicks, user_nick, profile):
         """Called when a MUC room is joined"""
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug (_("Room [%(room_name)s] joined by %(profile)s, users presents:%(users)s") % {'room_name':room_id+'@'+room_service, 'profile': profile, 'users':room_nicks})
         room_jid=room_id+'@'+room_service
@@ -254,7 +254,7 @@
 
     def roomUserJoined(self, room_id, room_service, user_nick, user_data, profile):
         """Called when an user joined a MUC room"""
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         room_jid=room_id+'@'+room_service
         if self.chat_wins.has_key(room_jid):
@@ -263,7 +263,7 @@
 
     def roomUserLeft(self, room_id, room_service, user_nick, user_data, profile):
         """Called when an user joined a MUC room"""
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         room_jid=room_id+'@'+room_service
         if self.chat_wins.has_key(room_jid):
@@ -272,7 +272,7 @@
 
     def roomNewSubject(self, room_id, room_service, subject, profile):
         """Called when subject of MUC room change"""
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         room_jid=room_id+'@'+room_service
         if self.chat_wins.has_key(room_jid):
@@ -280,7 +280,7 @@
             debug (_("new subject for room [%(room_jid)s]: %(subject)s") % {'room_jid':room_jid, "subject":subject})
     
     def tarotGameStarted(self, room_jid, referee, players, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug  (_("Tarot Game Started \o/"))
         if self.chat_wins.has_key(room_jid):
@@ -288,7 +288,7 @@
             debug (_("new Tarot game started by [%(referee)s] in room [%(room_jid)s] with %(players)s") % {'referee':referee, 'room_jid':room_jid, 'players':[str(player) for player in players]})
        
     def tarotGameNew(self, room_jid, hand, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug (_("New Tarot Game"))
         if self.chat_wins.has_key(room_jid):
@@ -296,21 +296,21 @@
 
     def tarotChooseContrat(self, room_jid, xml_data, profile):
         """Called when the player has too select his contrat"""
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug (_("Tarot: need to select a contrat"))
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].getGame("Tarot").chooseContrat(xml_data)
 
     def tarotShowCards(self, room_jid, game_stage, cards, data, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug (_("Show cards"))
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].getGame("Tarot").showCards(game_stage, cards, data)
 
     def tarotMyTurn(self, room_jid, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug (_("My turn to play"))
         if self.chat_wins.has_key(room_jid):
@@ -318,21 +318,21 @@
     
     def tarotScore(self, room_jid, xml_data, winners, loosers, profile): 
         """Called when the game is finished and the score are updated"""
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug (_("Tarot: score received"))
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].getGame("Tarot").showScores(xml_data, winners, loosers)
 
     def tarotCardsPlayed(self, room_jid, player, cards, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug (_("Card(s) played (%(player)s): %(cards)s") % {"player":player, "cards":cards})
         if self.chat_wins.has_key(room_jid):
             self.chat_wins[room_jid].getGame("Tarot").cardsPlayed(player, cards)
    
     def tarotInvalidCards(self, room_jid, phase, played_cards, invalid_cards, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug (_("Cards played are not valid: %s") % invalid_cards)
         if self.chat_wins.has_key(room_jid):
@@ -340,7 +340,7 @@
    
     def subscribe(self, type, raw_jid, profile):
         """Called when a subsciption management signal is received"""
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         entity = JID(raw_jid)
         if type=="subscribed":
@@ -364,7 +364,7 @@
         pass  #FIXME
     
     def paramUpdate(self, name, value, namespace, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         debug(_("param update: [%(namespace)s] %(name)s = %(value)s") % {'namespace':namespace, 'name':name, 'value':value})
         if (namespace,name) == ("Connection", "JabberID"):
@@ -374,7 +374,7 @@
             self.profiles[profile]['watched']=value.split()
 
     def contactDeleted(self, jid, profile):
-        if not self.__check_profile(profile):
+        if not self.check_profile(profile):
             return
         target = JID(jid)
         self.CM.remove(target)