Menu

#100 Extend libpurple D-Bus interface

closed
None
Pidgin
5
2018-01-19
2017-08-06
No

The question if SIPE can be controlled via the libpurple D-Bus interface has been raised in the past, e.g. in [8bb88508]. After studying the libpurple source code I came to the conclusion that it is possible for third-party plugins to extend the libpurple D-Bus interface with own function calls.

A first example for SipeJoinConferenceUri has been pushed as git commit 3cd9e145. Example code how to use the the API from a script has been included.

Related

Forums: 8bb88508
Forums: join meeting from command line or dbus?

Discussion

  • Stefan Becker

    Stefan Becker - 2017-08-06
    • summary: Support for libpurple D-Bus interface --> Extend libpurple D-Bus interface
     
  • Stefan Becker

    Stefan Becker - 2017-08-15
    • status: accepted --> closed
     
  • Stefan Becker

    Stefan Becker - 2017-08-15

    Implemented in git commit 5a68e728

    List of D-Bus interfaces and some example code can be found in the README file.

     
  • Brian J. Murrell

    This is cool!

    Just to contibute back a bit, I wrote this URL Open wrapper script which I put into a file named "open-url" in my $PATH somewhere:

    #!/bin/bash
    
    case "$1" in
        http*://meet.example.com/*)
            join_conference "$1"
        ;;
        *)
            exec /opt/google/chrome/google-chrome --new-window "$@"
        ;;
    esac
    

    Which I then tell my desktop (i.e. GNOME, Cinnamon, etc.) how to open with this in ~/.local/share/applications/open-url.desktop:

    [Desktop Entry]
    Version=1.0
    Name=Open A URL
    GenericName=Open A URL
    Comment=Open A URL
    Exec=/path/to/open-url %U
    Terminal=false
    X-MultipleArgs=false
    Type=Application
    Icon=chromium-browser
    Categories=Network;WebBrowser;
    StartupWMClass=Chromium-browser
    StartupNotify=true
    X-Ayatana-Desktop-Shortcuts=NewWindow;Incognito;TempProfile
    MimeType=x-scheme-handler/unknown;x-scheme-handler/about;text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
    

    A path may or may not be needed in the Exec line. I have not tested without.

    I then put into a file called join_conference that is also in my $PATH:

    #!/usr/bin/python
    
    import sys
    import os
    import dbus
    
    myname = os.path.basename(sys.argv[0])
    
    bus       = dbus.SessionBus()
    object    = bus.get_object("im.pidgin.purple.PurpleService",
                               "/im/pidgin/purple/PurpleObject")
    purple    = dbus.Interface(object, "im.pidgin.purple.PurpleInterface")
    accountId = purple.PurpleAccountsFind("brian@example.com", 'prpl-sipe')
    
    if myname == "call_number":
        number = sys.argv[1]
        if number[0] is not "+":
            print "Phone number must start with +"
            sys.exit(1)
        purple.SipeCallPhoneNumber(accountId, number);
    elif myname == "join_conference":
        purple.SipeJoinConferenceWithUri(accountId, sys.argv[1]);
    

    As you can see, you can link the above to "call_number" to be able to call phone numbers if your SIPE account is configured/allowed to do so.

    Just set your desktop's "Preferred Applications" entry for a browser to "Open A URL" and you should now be able to click on Lync meeting/converence URIs and be joined to the conference.

    You might also have/want to adjust the open-url script to point at your preferred browser and/or alter the command-line arguments. Personally, I prefer links I click on to open in new windows as you an see.

     

Log in to post a comment.

MongoDB Logo MongoDB