Remove trailing whitespaces.
This commit is contained in:
parent
310e2cc347
commit
27b3592e16
1 changed files with 899 additions and 899 deletions
|
|
@ -37,7 +37,7 @@ class QuickApp(object):
|
|||
self.profiles = {}
|
||||
self.single_profile = single_profile
|
||||
self.check_options()
|
||||
|
||||
|
||||
## bridge ##
|
||||
try:
|
||||
self.bridge=DBusBridgeFrontend()
|
||||
|
|
@ -81,11 +81,11 @@ class QuickApp(object):
|
|||
self.bridge.register("quizGameAnswerResult", self.quizGameAnswerResult, "plugin")
|
||||
self.bridge.register("quizGameTimerExpired", self.quizGameTimerExpired, "plugin")
|
||||
self.bridge.register("quizGameTimerRestarted", self.quizGameTimerRestarted, "plugin")
|
||||
|
||||
|
||||
self.current_action_ids = set()
|
||||
self.current_action_ids_cb = {}
|
||||
self.media_dir = self.bridge.getConfig('','media_dir')
|
||||
|
||||
|
||||
def check_profile(self, profile):
|
||||
"""Tell if the profile is currently followed by the application"""
|
||||
return profile in self.profiles.keys()
|
||||
|
|
@ -93,7 +93,7 @@ class QuickApp(object):
|
|||
def postInit(self):
|
||||
"""Must be called after initialization is done, do all automatic task (auto plug profile)"""
|
||||
if self.options.profile:
|
||||
if not self.bridge.getProfileName(self.options.profile):
|
||||
if not self.bridge.getProfileName(self.options.profile):
|
||||
error(_("Trying to plug an unknown profile (%s)" % self.options.profile))
|
||||
else:
|
||||
self.plug_profile(self.options.profile)
|
||||
|
|
@ -116,7 +116,7 @@ class QuickApp(object):
|
|||
|
||||
def _getParamError(self, ignore):
|
||||
error(_("Can't get profile parameter"))
|
||||
|
||||
|
||||
def plug_profile(self, profile_key='@DEFAULT@'):
|
||||
"""Tell application which profile must be used"""
|
||||
if self.single_profile and self.profiles:
|
||||
|
|
@ -132,11 +132,11 @@ class QuickApp(object):
|
|||
self.profiles[profile]={}
|
||||
if self.single_profile:
|
||||
self.profile = profile
|
||||
|
||||
|
||||
###now we get the essential params###
|
||||
self.bridge.asyncGetParamA("JabberID","Connection", profile_key=profile,
|
||||
callback=lambda _jid: self.plug_profile_2(_jid, profile), errback=self._getParamError)
|
||||
|
||||
|
||||
def plug_profile_2(self, _jid, profile):
|
||||
self.profiles[profile]['whoami'] = JID(_jid)
|
||||
self.bridge.asyncGetParamA("autoconnect","Connection", profile_key=profile,
|
||||
|
|
@ -152,7 +152,7 @@ class QuickApp(object):
|
|||
self.bridge.asyncConnect(profile, callback=lambda: self.plug_profile_5(watched, autoconnect, profile), errback=lambda ignore: error(_('Error during autoconnection')))
|
||||
else:
|
||||
self.plug_profile_5(watched, autoconnect, profile)
|
||||
|
||||
|
||||
def plug_profile_5(self, watched, autoconnect, profile):
|
||||
self.profiles[profile]['watched'] = watched.split() #TODO: put this in a plugin
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ class QuickApp(object):
|
|||
for confirm_id, confirm_type, data in self.bridge.getWaitingConf(profile):
|
||||
self.askConfirmation(confirm_id, confirm_type, data, profile)
|
||||
|
||||
|
||||
|
||||
|
||||
def unplug_profile(self, profile):
|
||||
"""Tell the application to not follow anymore the profile"""
|
||||
|
|
@ -224,7 +224,7 @@ class QuickApp(object):
|
|||
debug(_("Disconnected"))
|
||||
self.contact_list.clearContacts()
|
||||
self.setStatusOnline(False)
|
||||
|
||||
|
||||
def connectionError(self, error_type, profile):
|
||||
"""called when something goest wrong with the connection"""
|
||||
if not self.check_profile(profile):
|
||||
|
|
@ -250,15 +250,15 @@ class QuickApp(object):
|
|||
return
|
||||
from_jid = JID(from_jid_s)
|
||||
to_jid = JID(to_jid_s)
|
||||
|
||||
|
||||
from_me = from_jid.short == self.profiles[profile]['whoami'].short
|
||||
win = to_jid if from_me else from_jid
|
||||
|
||||
|
||||
if _type != "groupchat" and self.contact_list.getSpecial(win) == "MUC":
|
||||
#we have a private message in a MUC room
|
||||
#XXX: normaly we use bare jid as key, here we need the full jid
|
||||
# so we cheat by replacing the "/" before the resource by
|
||||
# a "@", so the jid is invalid,
|
||||
# a "@", so the jid is invalid,
|
||||
new_jid = escapePrivate(win)
|
||||
if from_me:
|
||||
to_jid = new_jid
|
||||
|
|
@ -268,11 +268,11 @@ class QuickApp(object):
|
|||
self.contact_list.add(new_jid)
|
||||
|
||||
self.newMessage(from_jid, to_jid, msg, _type, extra, profile)
|
||||
|
||||
|
||||
def newMessage(self, from_jid, to_jid, msg, _type, extra, profile):
|
||||
from_me = from_jid.short == self.profiles[profile]['whoami'].short
|
||||
win = to_jid if from_me else from_jid
|
||||
|
||||
|
||||
self.current_action_ids = set()
|
||||
self.current_action_ids_cb = {}
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ class QuickApp(object):
|
|||
assert alert_type in ['INFO','ERROR']
|
||||
self.showDialog(unicode(msg),unicode(title),alert_type.lower())
|
||||
|
||||
|
||||
|
||||
def setStatusOnline(self, online=True):
|
||||
pass
|
||||
|
||||
|
|
@ -309,21 +309,21 @@ class QuickApp(object):
|
|||
self.setStatusOnline(False)
|
||||
return
|
||||
|
||||
self.contact_list.updatePresence(from_jid, show, priority, statuses)
|
||||
|
||||
self.contact_list.updatePresence(from_jid, show, priority, statuses)
|
||||
|
||||
if show != 'unavailable':
|
||||
|
||||
|
||||
#FIXME: must be moved in a plugin
|
||||
if from_jid.short in self.profiles[profile]['watched'] and not from_jid.short in self.profiles[profile]['onlineContact']:
|
||||
self.showAlert(_("Watched jid [%s] is connected !") % from_jid.short)
|
||||
|
||||
self.profiles[profile]['onlineContact'].add(from_jid) #FIXME onlineContact is useless with CM, must be removed
|
||||
|
||||
|
||||
#TODO: vcard data (avatar)
|
||||
|
||||
if show=="unavailable" and from_jid in self.profiles[profile]['onlineContact']:
|
||||
self.profiles[profile]['onlineContact'].remove(from_jid)
|
||||
|
||||
|
||||
def roomJoined(self, room_jid, room_nicks, user_nick, profile):
|
||||
"""Called when a MUC room is joined"""
|
||||
if not self.check_profile(profile):
|
||||
|
|
@ -374,7 +374,7 @@ class QuickApp(object):
|
|||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].setSubject(subject)
|
||||
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):
|
||||
return
|
||||
|
|
@ -382,7 +382,7 @@ class QuickApp(object):
|
|||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].startGame("Tarot", referee, players)
|
||||
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):
|
||||
return
|
||||
|
|
@ -411,8 +411,8 @@ class QuickApp(object):
|
|||
debug (_("My turn to play"))
|
||||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].getGame("Tarot").myTurn()
|
||||
|
||||
def tarotScore(self, room_jid, xml_data, winners, loosers, profile):
|
||||
|
||||
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):
|
||||
return
|
||||
|
|
@ -426,14 +426,14 @@ class QuickApp(object):
|
|||
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):
|
||||
return
|
||||
debug (_("Cards played are not valid: %s") % invalid_cards)
|
||||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].getGame("Tarot").invalidCards(phase, played_cards, invalid_cards)
|
||||
|
||||
|
||||
def quizGameStarted(self, room_jid, referee, players, profile):
|
||||
if not self.check_profile(profile):
|
||||
return
|
||||
|
|
@ -441,7 +441,7 @@ class QuickApp(object):
|
|||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].startGame("Quiz", referee, players)
|
||||
debug (_("new Quiz 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 quizGameNew(self, room_jid, data, profile):
|
||||
if not self.check_profile(profile):
|
||||
return
|
||||
|
|
@ -477,7 +477,7 @@ class QuickApp(object):
|
|||
return
|
||||
if self.chat_wins.has_key(room_jid):
|
||||
self.chat_wins[room_jid].getGame("Quiz").quizGameAnswerResult(player, good_answer, score)
|
||||
|
||||
|
||||
def quizGameTimerExpired(self, room_jid, profile):
|
||||
"""Called when nobody answered the question in time"""
|
||||
if not self.check_profile(profile):
|
||||
|
|
@ -516,10 +516,10 @@ class QuickApp(object):
|
|||
|
||||
def showDialog(self, message, title, type="info", answer_cb = None):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def showAlert(self, message):
|
||||
pass #FIXME
|
||||
|
||||
|
||||
def paramUpdate(self, name, value, namespace, profile):
|
||||
if not self.check_profile(profile):
|
||||
return
|
||||
|
|
@ -556,7 +556,7 @@ class QuickApp(object):
|
|||
|
||||
def askConfirmation(self, confirm_id, confirm_type, data, profile):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def actionResult(self, type, id, data):
|
||||
raise NotImplementedError
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue