XMPP plugin request

Got a good idea? You can suggest new features here.
Post Reply
Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Mon Jan 29, 2018 7:07 pm

ok ok :)

Code: Select all

20:06:39   Error loading plugin file: C:\ProgramData\EventGhost\plugins\XMPPPlus
20:06:39   Traceback (most recent call last) (0.5.0-rc4):
20:06:39     File "C:\ProgramData\EventGhost\plugins\XMPPPlus\__init__.py", line 36, in <module>
20:06:39       import sleekxmpp
20:06:39     File "C:\ProgramData\EventGhost\plugins\XMPPPlus\sleekxmpp\__init__.py", line 20, in <module>
20:06:39       from sleekxmpp.stanza import Message, Presence, Iq
20:06:39   ImportError: No module named sleekxmpp.stanza

Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Mon Jan 29, 2018 7:28 pm

I can't find the requested module anywhere in the plugin folder.

some useful information :
https://github.com/fritzy/SleekXMPP/wiki/Stanza-Objects

Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Mon Jan 29, 2018 11:15 pm

silly me, I've found the files, but why EG doesn't import them then ?

Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Mon Jan 29, 2018 11:16 pm

oh ! it's because the firs t letter is in capitals I think :)

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP plugin request

Post by kgschlosser » Mon Jan 29, 2018 11:54 pm

I have to add the plugin path to the paths to search for imports.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP plugin request

Post by kgschlosser » Tue Jan 30, 2018 12:24 am

ok this one should be good to go.
Attachments
XMPPPlus-0.1.0b.egplugin
(412.46 KiB) Downloaded 30 times
If you like the work I have been doing then feel free to Image

Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Tue Jan 30, 2018 7:02 am

here's what I get :
07:59:49 Plugin: XMPP Plus #2
07:59:49 Exception in thread Thread-5:
07:59:49 Traceback (most recent call last):
07:59:49 File "threading.pyc", line 801, in __bootstrap_inner
07:59:49 File "threading.pyc", line 754, in run
07:59:49 File "C:\ProgramData\EventGhost\plugins\XMPPPlus\__init__.py", line 141, in _connect
07:59:49 self._client = sleekxmpp.ClientXMPP(
07:59:49 AttributeError: 'module' object has no attribute 'ClientXMPP'
07:59:49
I like the new interface ;)

PS. Why does it at #2 after XMPP Plus ? I installed it once !

Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Tue Jan 30, 2018 7:16 am

When I try to send a message I get this :

Code: Select all

08:04:08      Error in Action: "XMPP Plus #2: Send Message"
08:04:08      Traceback (most recent call last) (0.5.0-rc4):
08:04:08        File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
08:04:08          return self(*args)
08:04:08        File "C:\ProgramData\EventGhost\plugins\XMPPPlus\__init__.py", line 313, in __call__
08:04:08          parse(html),
08:04:08        File "C:\ProgramData\EventGhost\plugins\XMPPPlus\__init__.py", line 172, in send_message
08:04:08          message = self._client.make_message(
08:04:08      AttributeError: 'NoneType' object has no attribute 'make_message'


When I try to disable the plugin, I get this :

Code: Select all

08:13:30   Error starting plugin: XMPP Plus
08:13:30   Traceback (most recent call last) (0.5.0-rc4):
08:13:30     File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginInstanceInfo.py", line 223, in Stop
08:13:30       self.instance.__stop__()
08:13:30     File "C:\ProgramData\EventGhost\plugins\XMPPPlus\__init__.py", line 186, in __stop__
08:13:30       self._client.disconnect()
08:13:30   AttributeError: 'NoneType' object has no attribute 'disconnect'
Once disabled, if I try to re-enable it, EG freezes :)

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP plugin request

Post by kgschlosser » Tue Jan 30, 2018 7:45 am

I have to change the class name..
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP plugin request

Post by kgschlosser » Tue Jan 30, 2018 7:46 am

did you get a login event?
If you like the work I have been doing then feel free to Image

Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Tue Jan 30, 2018 7:47 am

no, it doesn't connect at all

User avatar
kgschlosser
Site Admin
Posts: 4023
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP plugin request

Post by kgschlosser » Tue Jan 30, 2018 10:36 am

OK this is a working version...

There is one issue with it but seeing as it is the "old way" I do not know if I will bother to fix it.

Port 5223 does not work. it gets stuck in a never ending loop. and that port has been replaced with 5222 so the plugin is defaulted to that port.

you have 2 actions. one to send messages and the other to send presence.

you get 2 events one for incoming messages and one for incoming presences.

the payload of those events are objects. and there are a few specific features of each


message payload

Code: Select all


message = eg.event.payload
print message.sender
print message.body
print message.room
print message.type
print message.subject

message.reply('This is a reply')

presence payload

Code: Select all


presence = eg.event.payload

print presence.sender
print presence.type
print presence.priority
print presence.status

presence.unsubscribe()

If you are running into an issue please delete your debugging log file. go into the __init__.py file of the plugin and change DEBUGGING = False to DEBUGGING = True then start EG with the -debug command line switch. This is going to cause all kinds of debugging data to print out. once you have encountered the problem exit EG and attach that debugging log file to a forum post. the debugging log file is located in %appdata%\eventghost the file is log.txt
Attachments
XMPPPlus-0.1.1b.egplugin
(412.74 KiB) Downloaded 27 times
If you like the work I have been doing then feel free to Image

Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Tue Jan 30, 2018 12:12 pm

man.... I don't know what to say !! what you have done is just brilliant !!! thank you !
kgschlosser wrote:
Tue Jan 30, 2018 10:36 am
OK this is a working version...

There is one issue with it but seeing as it is the "old way" I do not know if I will bother to fix it.

Port 5223 does not work. it gets stuck in a never ending loop. and that port has been replaced with 5222 so the plugin is defaulted to that port.
I didn't quite understand what was the bug ? is it the fact that we're not able to use port 5223 or something else ? if you're talking about that, then it's not a bug ! I never used this port, the default xmpp port is 5222 :
https://www.iana.org/assignments/servic ... l?&page=90
https://tools.ietf.org/html/rfc6120

kgschlosser wrote:
Tue Jan 30, 2018 10:36 am
you have 2 actions. one to send messages and the other to send presence.

you get 2 events one for incoming messages and one for incoming presences.

the payload of those events are objects. and there are a few specific features of each


message payload

Code: Select all


message = eg.event.payload
print message.sender
print message.body
print message.room
print message.type
print message.subject

message.reply('This is a reply')

presence payload

Code: Select all


presence = eg.event.payload

print presence.sender
print presence.type
print presence.priority
print presence.status

presence.unsubscribe()

I like the way you handled this, it's more complete than with the previous plugin, wouldn't be more clean or should I say more meaningful to get all these information in the event/payload itself ? for example, instead of this line :
XMPPPlus.Incoming.Message <class 'eg.UserPluginModule.XMPPPlus.Message'>
it would be better to have something like this I guess :
XMPPPlus.Incoming.Message [sender, body, room, type, subject]

we could apply the mechanism for the presence event as well :
XMPPPlus.Incoming.Presence <class 'eg.UserPluginModule.XMPPPlus.Presence'>
use this instead :
XMPPPlus.Incoming.Presence [sender, type, priority, status]
What do you think about it ? it's just a suggestion, but I suppose you did the way you did for a specific reason ? what is it ?
I think it will be more useful, and it will avoid having several times the same line at login :) (each line below corresponds to one contact) :

Code: Select all

12:44:02   XMPP Plus: Connected
12:44:02   XMPP Plus: Authentication Successful
12:44:02   XMPP Plus: Session Started
12:44:02   XMPPPlus.Incoming.Presence <class 'eg.UserPluginModule.XMPPPlus.Presence'>
12:44:02   XMPPPlus.Incoming.Presence <class 'eg.UserPluginModule.XMPPPlus.Presence'>
12:44:02   XMPPPlus.Incoming.Presence <class 'eg.UserPluginModule.XMPPPlus.Presence'>
12:44:02   XMPPPlus.Incoming.Presence <class 'eg.UserPluginModule.XMPPPlus.Presence'>
12:44:02   XMPPPlus.Incoming.Presence <class 'eg.UserPluginModule.XMPPPlus.Presence'>
12:44:02   XMPP Plus: Roster Received
or even better, you keep your current method, and just generate an extra event like I specified it above ? I don't know, you tell me what's best. I must admit that your way has several advantages the only drawback is that it's not user friendly in EG log panel and we don't know exactly what's happening until we use some scripting code to display things.


kgschlosser wrote:
Tue Jan 30, 2018 10:36 am
If you are running into an issue please delete your debugging log file. go into the __init__.py file of the plugin and change DEBUGGING = False to DEBUGGING = True then start EG with the -debug command line switch. This is going to cause all kinds of debugging data to print out. once you have encountered the problem exit EG and attach that debugging log file to a forum post. the debugging log file is located in %appdata%\eventghost the file is log.txt
So far, everything works just fine, i can send/receive messages without a hitch ! :) you're really awesome ! I'm going to play around with it and if I encounter anything I will let you know.
Last edited by Snowbird on Tue Jan 30, 2018 3:15 pm, edited 1 time in total.

Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Tue Jan 30, 2018 1:03 pm

here's a possible bug or not yet handled situation, on my smartphone, when my android xmpp client goes offline, then when I get back online, my android client sees the EG client as offline, despite the fact that it was previously set as online (before I logged off/on my android client). So it looks like the EG client doesn't send periodically its presence status to the remote xmpp server, that's why the android client doens't know the online status of the EG client.

On the other hand, when I send manually the presence status from the EG client, it works perfectly, and it's seen properly on my android client.

Returning to the bug hunt :)

Snowbird
Experienced User
Posts: 340
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP plugin request

Post by Snowbird » Tue Jan 30, 2018 3:38 pm

I saw that you have selected 4 of the 6 Presence Types :
  • Away
    Chat
    DND
    XA
What happened to :
  • Offline
    Available
They can't be used here ?

Post Reply