python, dbus and pointers help.

Discussion in 'Python' started by Glich, Mar 24, 2008.

  1. Glich

    Glich Guest

    '''
    hello, using pidgin instant messenger I can get the value of 'message'
    when one is being sent but,
    I dont know how to chage the value of message.

    from the documentation (http://developer.pidgin.im/doxygen/dev/html/
    conversation-signals.html#sending-im-msg):
    _____________________________
    sending-im-msg:

    Emitted before sending an IM to a user. message is a pointer to the
    message string, so the plugin can replace the message before being
    sent.
    _____________________________

    I think python get's a copy of the message (this is just a guess). How
    can I change the message before it is sent?

    Thanks.
    The code is taken from http://developer.pidgin.im/wiki/DbusHowto#Furtherreading
    and changed only a small amount.
    '''

    #!/usr/bin/env python

    def cb_func(account, rec, message):
    #change message here somehow?
    print message

    import dbus, gobject
    from dbus.mainloop.glib import DBusGMainLoop
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
    bus = dbus.SessionBus()

    bus.add_signal_receiver(cb_func,

    dbus_interface="im.pidgin.purple.PurpleInterface",
    signal_name="SendingImMsg")

    loop = gobject.MainLoop()
    loop.run()
     
    Glich, Mar 24, 2008
    #1
    1. Advertising

  2. Glich

    Glich Guest

    or a way of letting me see the message then cancel sending it then I
    could create a new message and send that one. but I cant see this in
    the documentation
     
    Glich, Mar 24, 2008
    #2
    1. Advertising

  3. Glich

    Glich Guest

    A replay from ubuntu forums:
    by Roptaty:

    Using dbus you can only get information from Pidgin, you cant modify
    the information. To do this, you need to write a plugin loaded in
    Pidgin. (See http://developer.pidgin.im/wiki/DbusHowto )
     
    Glich, Mar 25, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bob
    Replies:
    1
    Views:
    288
  2. bob
    Replies:
    0
    Views:
    301
  3. bob
    Replies:
    1
    Views:
    705
    alisonken1
    Jul 29, 2006
  4. est

    dbus-python for windows

    est, Jan 2, 2008, in forum: Python
    Replies:
    4
    Views:
    769
  5. Oguz Yarimtepe

    python-dbus example request

    Oguz Yarimtepe, Jun 25, 2008, in forum: Python
    Replies:
    0
    Views:
    341
    Oguz Yarimtepe
    Jun 25, 2008
Loading...

Share This Page