emesene forum
July 31, 2010, 01:28:10 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: CACHE KEY ERRORS? NICK NOT SAVED? UPGRADE TO 1.6.2 FIRST!

REPORT ANY ISSUE HERE - PLEASE CHECK IF THE PROBLEM HAS ALREADY BEEN REPORTED FIRST -- THANKS
 
  Home   Forum   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [PATCH] Patch for the dbus plugin  (Read 846 times)
Ivan!
Sr. Member
****

l33tness: 2
Offline Offline

Posts: 59



View Profile WWW
« on: February 17, 2010, 06:19:08 AM »

Hi Smiley

I'm developing an helper for docky, that changes emesene icon according to emesene status.
And to do this, i used dbus to comunicate (docky-emesene), i needed a little change to dbus plugin (there weren't 2 things: get emesene status, and a signal on status change)...

So i made a little patch, i hope this will go into the svn ^^
Code:
Index: plugins_base/Dbus.py
===================================================================
--- plugins_base/Dbus.py (revisione 2255)
+++ plugins_base/Dbus.py (copia locale)
@@ -58,6 +58,7 @@
         self.user_offline_id = None
         self.self_nick_changed_id = None
         self.psm_changed_id = None
+        self.status_changed_id = None
 
         self.dbus_object = None
 
@@ -71,6 +72,8 @@
                                                   self.self_nick_changed)
         self.psm_changed_id = self.connect('personal-message-changed',
                                             self.psm_changed)
+        self.status_changed_id = self.connect('self-status-changed',
+                                            self.status_changed)
 
         self.enabled = True
 
@@ -80,6 +83,7 @@
         self.disconnect( self.user_offline_id )
         self.disconnect( self.self_nick_changed_id )
         self.disconnect( self.psm_changed_id )
+        self.disconnect( self.status_changed_id )
 
         self.destroy_dbus_session()
 
@@ -122,6 +126,10 @@
         if(oldStatus=='FLN'):
             self.dbus_object.user_connect(user)
 
+    def status_changed(self, msnp, status):
+        newstatus = self.controller.contacts.get_status()
+        self.dbus_object.status_changed('', newstatus)
+
     def user_offline(self, msnp, user):
         self.dbus_object.user_offline(user)
 
@@ -142,6 +150,11 @@
 
         #Methods
         @dbus.service.method(BUS_NAME)
+        def get_status(self):
+            return self.controller.contacts.get_status()
+
+
+        @dbus.service.method(BUS_NAME)
         def set_psm(self, text):
             self.contact_manager.set_message(text)
             return 'Psm Changed'
@@ -267,5 +280,10 @@
         @dbus.service.signal(BUS_NAME)
         def psm_changed(self, email, pm):
             pass
+
+        @dbus.service.signal(BUS_NAME)
+        def status_changed(self, email, status):
+            pass
+
 except Exception, e:
     dbusError = e

preview  Smiley
« Last Edit: March 08, 2010, 09:20:55 AM by Ivan! » Logged
cando
Hero Member
*****

l33tness: 4
Offline Offline

Posts: 324



View Profile WWW
« Reply #1 on: February 17, 2010, 08:39:11 AM »

very nice man!!!!!!
Logged

Computers are incredibly fast, accurate and stupid. Humans are incredibly slow, inaccurate and intelligent. Together they are a power that exceeds the imagination.(Albert Einstein)
C10uD
ololol
Administrator
Hero Member
*****

l33tness: -9990
Offline Offline

Posts: 2308



View Profile Email
« Reply #2 on: February 17, 2010, 09:19:26 AM »

thank you, will land in svn asap
Logged
ukblacknight
Sr. Member
****

l33tness: 4
Offline Offline

Posts: 87



View Profile
« Reply #3 on: February 20, 2010, 09:38:03 AM »

Hey dude, I've also been working on a helper, but with a different functionality of showing an unread message counter badge!  I also needed some patches applied to the dbus, so once yours has made it I'll submit mine and we can merge our helper files so it has both functionalities?
Logged
C10uD
ololol
Administrator
Hero Member
*****

l33tness: -9990
Offline Offline

Posts: 2308



View Profile Email
« Reply #4 on: February 20, 2010, 10:30:43 AM »

i already committed his patch iirc
Logged
Ivan!
Sr. Member
****

l33tness: 2
Offline Offline

Posts: 59



View Profile WWW
« Reply #5 on: February 20, 2010, 10:42:44 AM »

Hey dude, I've also been working on a helper, but with a different functionality of showing an unread message counter badge!  I also needed some patches applied to the dbus, so once yours has made it I'll submit mine and we can merge our helper files so it has both functionalities?
maybe we can, but my helper for now won't be added to docky (because it works only with a svn version), so for now you can make a separate helper and it will be included in docky Smiley


btw, this is my helper Smiley
https://bugs.launchpad.net/docky/+bug/524645
(use with svn version, and create a folder called emesene_theme with 5 pngs [online.png, idle.png, away.png, hidden.png, busy.png] in the ~/.local/share/docky/helpers folder)
Logged
ukblacknight
Sr. Member
****

l33tness: 4
Offline Offline

Posts: 87



View Profile
« Reply #6 on: February 20, 2010, 10:49:44 AM »

Cool Smiley Mine is working off the PPA version, although it's requiring a bit of DBus hacking and I still haven't got it fully working yet, it should be ready tonight I reckon Smiley  I'll see if I can get my changes applied and then submit the helper to launchpad.
Logged
ukblacknight
Sr. Member
****

l33tness: 4
Offline Offline

Posts: 87



View Profile
« Reply #7 on: February 20, 2010, 12:16:21 PM »

Ok so here is my patch from the latest svn, adding to the work that Ivan! did.  Please check over it as I had a slight hic-up on my end of things, however I believe that the diff file is fine.

The patch will allow the emesene docky helper to work Smiley  If there are problems with the patch, please let me know!
Logged
hit^
Hero Member
*****

l33tness: 1
Offline Offline

Posts: 370


svn up´d


View Profile
« Reply #8 on: February 25, 2010, 12:02:08 AM »

Code:
Traceback (most recent call last):

  File "/home/hit/Apps/emesene/plugins_base/Dbus.py", line 161, in message_read
    self.dbus_object.set_message_count(0)

AttributeError: 'NoneType' object has no attribute 'set_message_count'

Connection was lost and some conversations were open..
Logged

"We are changing the world, one commit at a time."
ukblacknight
Sr. Member
****

l33tness: 4
Offline Offline

Posts: 87



View Profile
« Reply #9 on: February 25, 2010, 06:56:02 AM »

Yeah I get that sometimes too.  I'm currently looking into it, but difficult to test!
Logged
hit^
Hero Member
*****

l33tness: 1
Offline Offline

Posts: 370


svn up´d


View Profile
« Reply #10 on: February 25, 2010, 07:03:46 AM »

Now I disconnected from msn, then unplugged the cable and still got this exception.
Logged

"We are changing the world, one commit at a time."
ukblacknight
Sr. Member
****

l33tness: 4
Offline Offline

Posts: 87



View Profile
« Reply #11 on: February 25, 2010, 11:57:27 AM »

Think I found the problem - seems to have fixed it on my end anyway.  Test away Smiley
Logged
Ivan!
Sr. Member
****

l33tness: 2
Offline Offline

Posts: 59



View Profile WWW
« Reply #12 on: March 08, 2010, 06:23:58 AM »

Since some updates the dbus plugin is not able to retrieve the status correctly...
I don't know the source of this error, because none of the previous rev (of Dbus.py) changed my lines... boh...

btw this is a fix...
this is the (very small) patch:

Code:
Index: plugins_base/Dbus.py
===================================================================
--- plugins_base/Dbus.py (revisione 2340)
+++ plugins_base/Dbus.py (copia locale)
@@ -162,7 +162,7 @@
         if self.dbus_object == None:
             self.start_dbus()
             
-        newstatus = self.controller.contacts.get_status()
+        newstatus = self.msn.status
         self.dbus_object.status_changed('', newstatus)
 
     def user_offline(self, msnp, user):
@@ -222,7 +222,7 @@
         #Methods
         @dbus.service.method(BUS_NAME)
         def get_status(self):
-            return self.controller.contacts.get_status()
+            return self.msn.status
 
         @dbus.service.method(BUS_NAME)
         def show(self):

=)
Logged
arielj
Administrator
Hero Member
*****

l33tness: 30
Offline Offline

Posts: 1362


globitz!


View Profile Email
« Reply #13 on: March 08, 2010, 07:18:16 AM »

ok, applied, thanks!
Logged
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v.1.0.6 beta 2 © Bloc
Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!