def new_message(self, conversation): if not settings.get_notify_on_messagerecieve( ) or self.skype.skype_presence == Skype4Py.cusDoNotDisturb: return #conversation.skypereturn.Chat.Type == Skype4Py.chatTypeMultiChat and if conversation.skypereturn.Chat.Topic: group_chat_title = unicode( conversation.skypereturn.Sender.FullName + " ► " + conversation.skypereturn.Chat.Topic) else: group_chat_title = unicode(conversation.display_name) icon = "" if settings.get_display_notification_avatars(): avatar = SkypeAvatar(conversation.skypereturn.Sender.Handle) if avatar.filename: icon = '-i "' + avatar.filename + '" ' else: icon = '-i "/usr/share/skype-wrapper/icons/skype-wrapper-48.svg" ' if helpers.haveUnity(): unitylauncher.count( len(self.indicators) + self.skype.incomingfilecount) unitylauncher.createUnreadMessageQuickList( self.skype.unread_conversations, self.show_conversation_quicklist) unitylauncher.redrawQuicklist() unitylauncher.count( len(self.indicators) + self.skype.incomingfilecount) os.system(u'notify-send ' + icon + '"' + group_chat_title + '" "' + conversation.skypereturn.Body + '"')
def new_message(self, conversation): if not settings.get_notify_on_messagerecieve() or self.skype.skype_presence == Skype4Py.cusDoNotDisturb: return #conversation.skypereturn.Chat.Type == Skype4Py.chatTypeMultiChat and conversation.display_name = conversation.skypereturn.Chat.Topic or conversation.display_name name = conversation.skypereturn.Sender.DisplayName or conversation.skypereturn.Sender.FullName or conversation.skypereturn.Sender.Handle if len(conversation.skypereturn.Chat.Members) > 2: group_chat_title = unicode(name + " ► " + conversation.display_name) else: group_chat_title = unicode(conversation.display_name) icon = "" if settings.get_display_notification_avatars(): avatar = SkypeAvatar(conversation.skypereturn.Sender.Handle) if avatar.filename: icon = avatar.filename else: icon = "/usr/share/skype-wrapper/icons/skype-wrapper-48.svg" if helpers.haveUnity(): unitylauncher.count(len(self.indicators) + self.skype.incomingfilecount) unitylauncher.createUnreadMessageQuickList(self.skype.unread_conversations, self.show_conversation_quicklist) unitylauncher.redrawQuicklist() unitylauncher.count(len(self.indicators) + self.skype.incomingfilecount) helpers.notify(group_chat_title, conversation.skypereturn.Body, icon, group_chat_title, False, False, conversation.skypereturn.Chat.Topic)
def reset_indicators(self) : del self.indicators self.indicators = {} for _id in self.skype.unread_conversations: self.show_indicator(self.skype.unread_conversations[int(_id)]) if helpers.haveUnity(): unitylauncher.count(len(self.indicators) + self.skype.incomingfilecount) unitylauncher.createUnreadMessageQuickList(self.skype.unread_conversations, self.show_conversation_quicklist) unitylauncher.redrawQuicklist() unitylauncher.count(len(self.indicators) + self.skype.incomingfilecount)
def checkUnreadMessages(self): if not self.messageupdatepending: return AppletRunning self.messageupdatepending = False try : log("Checking unread messages", INFO) missedmessages = [] if self.skype.MissedMessages: for mesg in self.skype.MissedMessages: missedmessages.append(mesg) unread = self.unread_conversations self.unread_conversations = {} logged = False if missedmessages and self.cb_show_indicator: for mesg in reversed(missedmessages): try: id = mesg.Id if self.skype.Friends: for friend in self.skype.Friends: if mesg.Chat.DialogPartner == friend.Handle: display_name = friend.DisplayName or friend.FullName or friend.Handle break except: log("Couldn't get missed message Chat object", ERROR) continue if not id in self.unread_conversations: conversation = Conversation(display_name, mesg.Timestamp, mesg.Sender.Handle, mesg) self.name_mappings[id] = mesg.Sender.Handle self.unread_conversations[id] = conversation else: self.unread_conversations[id].add_timestamp(mesg.Timestamp) if helpers.isUserBlacklisted(mesg.Sender.Handle): self.unread_conversations[id].Read = True if not self.unread_conversations[id].Read: self.logMessage(self.unread_conversations[id]) self.cb_show_indicator(self.unread_conversations[id]) if len(unread) != len(self.unread_conversations): CPUPRIORITY = 1 if self.cb_read_within_skype: self.cb_read_within_skype() if helpers.haveUnity(): unitylauncher.urgent(True) unitylauncher.urgent(False) #limitcpu() CPUPRIORITY = 0 except Exception, e: log("Checking unread messages failed: "+str(e), WARNING)
def new_message(self, conversation): if not settings.get_notify_on_messagerecieve() or self.skype.skype_presence == Skype4Py.cusDoNotDisturb: return #conversation.skypereturn.Chat.Type == Skype4Py.chatTypeMultiChat and if conversation.skypereturn.Chat.Topic: group_chat_title = unicode(conversation.skypereturn.Sender.FullName + " ► " + conversation.skypereturn.Chat.Topic) else: group_chat_title = unicode(conversation.display_name) icon = "" if settings.get_display_notification_avatars(): avatar = SkypeAvatar(conversation.skypereturn.Sender.Handle) if avatar.filename: icon = '-i "'+avatar.filename+'" ' else: icon = '-i "/usr/share/skype-wrapper/icons/skype-wrapper-48.svg" ' if helpers.haveUnity(): unitylauncher.count(len(self.indicators) + self.skype.incomingfilecount) unitylauncher.createUnreadMessageQuickList(self.skype.unread_conversations, self.show_conversation_quicklist) unitylauncher.redrawQuicklist() unitylauncher.count(len(self.indicators) + self.skype.incomingfilecount) os.system(u'notify-send '+icon+'"'+group_chat_title+'" "'+conversation.skypereturn.Body+'"');
def checkFileTransfers(self) : if not self.filetransferupdatepending: return AppletRunning self.filetransferupdatepending = False try : log("Checking file transfers", INFO) for transfer in self.skype.ActiveFileTransfers: if not transfer.Id in self.filetransfers: self.filetransfers[transfer.Id] = FileTransfer(transfer) for transfer in self.skype.FileTransfers: if transfer.Id in self.filetransfers: self.filetransfers[transfer.Id].update(transfer) oldincoming = self.incomingfilecount self.incomingfilecount = 0 self.filetransfer = { "total" : -1, "current" : 0 } # should we send out notifications for k in self.filetransfers: v = self.filetransfers[k] if str(v.type) == "INCOMING": if "NEW" in str(v.status): self.incomingfilecount = self.incomingfilecount + 1 if helpers.haveUnity(): unitylauncher.urgent(True) else: if helpers.haveUnity(): unitylauncher.urgent(False) if settings.get_show_incoming_filetransfer_progress(): if "TRANSFERRING" in str(v.status) or "PAUSED" in str(v.status): self.filetransfer['total'] = self.filetransfer['total'] + v.skype_transfer.FileSize self.filetransfer['current'] = self.filetransfer['current'] + v.skype_transfer.BytesTransferred self.incomingfilecount = self.incomingfilecount + 1 self.filetransferupdatepending = True if not str(v.status) in v.notifications: if "NEW" in v.status: self.filetransfers[k].notifications[str(v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer(v, "* " + v.partner+ " wants to send you a file") if "TRANSFERRING" in v.status: self.filetransfers[k].notifications[str(v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer(v, "* " + v.partner+ " is busy sending you a file") self.filetransferupdatepending = True if "CANCELLED" in v.status: self.filetransfers[k].notifications[str(v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer(v, "* file transfer with " + v.partner+ " has been cancelled") if "COMPLETED" in v.status: self.filetransfers[k].notifications[str(v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer(v, "* " + v.partner+ " finished sending you a file") if helpers.haveUnity(): unitylauncher.urgent(True) if "FAILED" in v.status: self.filetransfers[k].notifications[str(v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer(v, "* " + v.partner+ " failed to send you a file") else: if "COMPLETED" in v.status: if helpers.haveUnity(): unitylauncher.urgent(False) if str(v.type) == "OUTGOING": if settings.get_show_outgoing_filetransfer_progress(): if "TRANSFERRING" in str(v.status) or "PAUSED" in str(v.status) or "REMOTELY_PAUSED" in str(v.status): self.filetransfer['total'] = self.filetransfer['total'] + v.skype_transfer.FileSize self.filetransfer['current'] = self.filetransfer['current'] + v.skype_transfer.BytesTransferred self.incomingfilecount = self.incomingfilecount + 1 self.filetransferupdatepending = True if not str(v.status) in v.notifications: if "TRANSFERRING" in v.status: self.filetransfers[k].notifications[str(v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer(v, "* " + v.partner+ " is busy receiving your file") self.filetransferupdatepending = True if "CANCELLED" in v.status: self.filetransfers[k].notifications[str(v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer(v, "* file transfer with " + v.partner+ " has been cancelled") if "COMPLETED" in v.status: self.filetransfers[k].notifications[str(v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer(v, "* " + v.partner+ " has received your file") if "FAILED" in v.status: self.filetransfers[k].notifications[str(v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer(v, "* " + v.partner+ " failed to receive your file") if self.filetransfer['total'] > -1: currentprogress = float(self.filetransfer['current']) / float(self.filetransfer['total']) if helpers.haveUnity(): unitylauncher.progress(currentprogress) else: if helpers.haveUnity(): unitylauncher.progress(-1) if oldincoming != self.incomingfilecount and self.cb_read_within_skype: self.cb_read_within_skype() #limitcpu() except Exception, e: log("Checking file transfers failed ("+str(e)+")", WARNING) raise
#MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR #PURPOSE. See the applicable version of the GNU Lesser General Public #License for more details. # #You should have received a copy of both the GNU Lesser General Public #License version 3 and version 2.1 along with this program. If not, see #<http://www.gnu.org/licenses/> # # Documentation: # just start it import helpers if helpers.haveUnity(): import unitylauncher from gi.repository import GObject import indicate import gtk import Skype4Py import shared import settings import os import sys import commands import time import dbus
def checkFileTransfers(self): if not self.filetransferupdatepending: return AppletRunning self.filetransferupdatepending = False try: log("Checking file transfers", INFO) for transfer in self.skype.ActiveFileTransfers: if not transfer.Id in self.filetransfers: self.filetransfers[transfer.Id] = FileTransfer(transfer) for transfer in self.skype.FileTransfers: if transfer.Id in self.filetransfers: self.filetransfers[transfer.Id].update(transfer) oldincoming = self.incomingfilecount self.incomingfilecount = 0 self.filetransfer = {"total": -1, "current": 0} # should we send out notifications for k in self.filetransfers: v = self.filetransfers[k] if str(v.type) == "INCOMING": if "NEW" in str(v.status): self.incomingfilecount = self.incomingfilecount + 1 if helpers.haveUnity(): unitylauncher.urgent(True) else: if helpers.haveUnity(): unitylauncher.urgent(False) if settings.get_show_incoming_filetransfer_progress(): if "TRANSFERRING" in str(v.status) or "PAUSED" in str( v.status): self.filetransfer['total'] = self.filetransfer[ 'total'] + v.skype_transfer.FileSize self.filetransfer['current'] = self.filetransfer[ 'current'] + v.skype_transfer.BytesTransferred self.incomingfilecount = self.incomingfilecount + 1 self.filetransferupdatepending = True if not str(v.status) in v.notifications: if "NEW" in v.status: self.filetransfers[k].notifications[str( v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer( v, "* " + v.partner + " wants to send you a file") if "TRANSFERRING" in v.status: self.filetransfers[k].notifications[str( v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer( v, "* " + v.partner + " is busy sending you a file") self.filetransferupdatepending = True if "CANCELLED" in v.status: self.filetransfers[k].notifications[str( v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer( v, "* file transfer with " + v.partner + " has been cancelled") if "COMPLETED" in v.status: self.filetransfers[k].notifications[str( v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer( v, "* " + v.partner + " finished sending you a file") if helpers.haveUnity(): unitylauncher.urgent(True) if "FAILED" in v.status: self.filetransfers[k].notifications[str( v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer( v, "* " + v.partner + " failed to send you a file") else: if "COMPLETED" in v.status: if helpers.haveUnity(): unitylauncher.urgent(False) if str(v.type) == "OUTGOING": if settings.get_show_outgoing_filetransfer_progress(): if "TRANSFERRING" in str(v.status) or "PAUSED" in str( v.status) or "REMOTELY_PAUSED" in str( v.status): self.filetransfer['total'] = self.filetransfer[ 'total'] + v.skype_transfer.FileSize self.filetransfer['current'] = self.filetransfer[ 'current'] + v.skype_transfer.BytesTransferred self.incomingfilecount = self.incomingfilecount + 1 self.filetransferupdatepending = True if not str(v.status) in v.notifications: if "TRANSFERRING" in v.status: self.filetransfers[k].notifications[str( v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer( v, "* " + v.partner + " is busy receiving your file") self.filetransferupdatepending = True if "CANCELLED" in v.status: self.filetransfers[k].notifications[str( v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer( v, "* file transfer with " + v.partner + " has been cancelled") if "COMPLETED" in v.status: self.filetransfers[k].notifications[str( v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer( v, "* " + v.partner + " has received your file") if "FAILED" in v.status: self.filetransfers[k].notifications[str( v.status)] = str(v.status) if self.cb_log_transfer: self.cb_log_transfer( v, "* " + v.partner + " failed to receive your file") if self.filetransfer['total'] > -1: currentprogress = float(self.filetransfer['current']) / float( self.filetransfer['total']) if helpers.haveUnity(): unitylauncher.progress(currentprogress) else: if helpers.haveUnity(): unitylauncher.progress(-1) if oldincoming != self.incomingfilecount and self.cb_read_within_skype: self.cb_read_within_skype() #limitcpu() except Exception, e: log("Checking file transfers failed (" + str(e) + ")", WARNING) raise
#WITHOUT ANY WARRANTY; without even the implied warranties of #MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR #PURPOSE. See the applicable version of the GNU Lesser General Public #License for more details. # #You should have received a copy of both the GNU Lesser General Public #License version 3 and version 2.1 along with this program. If not, see #<http://www.gnu.org/licenses/> # # Documentation: # just start it import helpers if helpers.haveUnity(): import unitylauncher from gi.repository import GObject import indicate import gtk import Skype4Py import shared import settings import os import sys import commands import time import dbus import subprocess