Menu

Repeating Reminder Sound Of New Messages

Dale
2009-11-01
2013-01-14
  • Dale

    Dale - 2009-11-01

    I'm not sure if this is implemented in a plugin already, but hopefully so.  The problem is that I often have my screen off, and can't see any notification of messages.  If I also have music playing or am out of the room I won't hear the sound.  What I would like is for a beep or chirp sound to repeat every so often (maybe 10 seconds) until I check the messages.

    Preferably this wouldn't be the the new IM sound, as that would be confusing.  It would be a different sound, which I could change to my liking.

    So does anyone know of anything like this existing?

     
  • Etan Reisner

    Etan Reisner - 2009-11-10

    I don't know of any such plugin already existing but one could certainly be written.

     
  • Anonymous

    Anonymous - 2009-11-10

    You can try this one:

    http://www.lib.unc.edu/reference/eref/pidgin/pidgin4lib.zip

    This repeats your "Message received begins conversation" sound every 30 seconds until the IM is answered.  I haven't tested in 2.6.x, but it worked in older versions.  It also auto-approves some buddy requests.

    If you want to modernize it or make the number of seconds configurable, the source is here:

    http://www.lib.unc.edu/reference/eref/pidgin/pidgin4lib.fw

    The source code uses the FunnelWeb literate-programming preprocessor and carries the GNU General Public License.

     
  • Dale

    Dale - 2009-11-11

    Thanks that does work.  It does have a few issues though.  I think I've changed it so that it uses a shorter time, and a different time.  However, it only plays the sound if the IM begins a conversation, not if you have a chat window open with that person already.  Also you have to send an IM to cancel the sound.

    I can't figure out the code enough to change that, does anyone have any ideas?  Also I can't get it to compile as it tells me:
    "error: 'for' loop initial declaration used outside C99 mode"
    I think I may be able to fix that though.

     
  • Dale

    Dale - 2009-11-12

    Ok, so I rewrote it from scratch, and it works nearly how I want it to.  The only problem is I can't seem to get a signal to fire for when the IM has focus.  I added a bunch of random signals and only four actually work.  Does anyone have any idea why these signals aren't firing?

        purple_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin,
                        PURPLE_CALLBACK(message_displayed_cb), NULL); //works
    purple_signal_connect(gtk_conv_handle, "conversation-switched", plugin,
                        PURPLE_CALLBACK(conv_switched), NULL); //works
    purple_signal_connect(conv_handle, "key-press-event", plugin,
                        PURPLE_CALLBACK(key), NULL);
    purple_signal_connect(conv_handle, "button-press-event", plugin,
                        PURPLE_CALLBACK(button), NULL);
    purple_signal_connect(conv_handle, "conversation-displayed", plugin,
                        PURPLE_CALLBACK(displayed), NULL);
    purple_signal_connect(conv_handle, "conversation-hiding", plugin,
                        PURPLE_CALLBACK(hiding), NULL);
    purple_signal_connect(conv_handle, "writing-im-msg", plugin,
                        PURPLE_CALLBACK(writing), NULL); //works
    purple_signal_connect(conv_handle, "focus-in-event", plugin,
                        PURPLE_CALLBACK(focus), NULL);
        purple_signal_connect(conv_handle, "deleting-conversation", plugin,
                            PURPLE_CALLBACK(deleting), NULL); //works

     
  • Etan Reisner

    Etan Reisner - 2009-11-12

    pidgin signals: displayed-im-msg, conversation-switched, conversation-displayed, conversation-hiding,
    purple signals: writing-im-msg, deleting-conversation
    GTK+ signals: key-press-event, button-press-event, focus-in-event

    You are only correctly connecting to: displayed-im-msg, conversation-switched, writing-im-msg, and deleting-conversation

    You need to use gtk_conv_handle for: conversation-displayed and conversation-hiding
    You need to use the glib/GTK+ signal functions for: key-press-event, button-press-event, and focus-in-event

     
  • Dale

    Dale - 2009-11-12

    Thank you, that makes sense thanks.  But I don't understand what the glib/GTK+ signal functions are.  I think this is an example of one:

        g_signal_connect(G_OBJECT(gtkblist->window), "focus-in-event",
    G_CALLBACK(focus), gtkblist);

    Unfortunately I don't really understand pointers, so I don't know how to modify that to work for me.  What do I replace gtkblist with for this use?  For example I have this code in the onload function:

        void *purple_conv_handle = purple_conversations_get_handle();
        …
        purple_signal_connect(purple_conv_handle, "writing-im-msg", plugin, //purple signals
                        PURPLE_CALLBACK(writing), NULL); //works

    Is there an equivalent for purple_conversations_get_handle() for GTK?

     
  • Etan Reisner

    Etan Reisner - 2009-11-13

    Yes, that g\_signal\_connect line is an example of connecting to a GTK+ signal and similarly the purple\_signal\_connect lines are examples of connecting to a libpurple (in that case) signal.

    Which signals you connect to and what you connect to them on depends entirely on what your goal is.

    That purple signal (as the documentation indicates) will fire (and call the registered callback function) "before a message is written in an IM conversation" which is useful if you want to change the message that is displayed or logged (but not what is actually sent or received). It is unlikely that for your purpose that is interesting.

    That GTK+ signal will fire whenever the buddy list window receives the focus. To use that for the conversation window you would need to find the GtkWindow representing the conversation window.

    You may be well served by looking at the pidgin Message Notification plugin (in the pidgin/plugins/notify.c file in the source) as it should have the basic framework for the sort of thing you want.

     
  • Dale

    Dale - 2009-11-13

    I've worked on this a bit more but I can't figure out how to find the handle of the GTK window.  I've been following notify (and a few others) as a guide but the code they use doesn't seem to work for me.

        PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
        g_signal_connect(gtkconv, "key-press-event", G_CALLBACK(key), conv); //crashes

    Anything I do which references gtkconv crashes Pidgin.  I just need to figure out how to get the handle of the conversation window.

    I've uploaded my complete source.

      : http://daleswanson.org/programs/reminder.c

     
  • Etan Reisner

    Etan Reisner - 2009-11-16

    A PidginConversation is not a GTK+ widget, and as such cannot be used in g_signal_connect calls.

    If you look at attach_signals in notify.c you will see how that plugin uses the gtkconv->entry and gtkconv->imhtml fields in g_signal_connect calls (because, as you can see in the documentation) those are GtkWidgets.

    If your desire is to get notification when the entire window is given focus I'm not sure how best to do that (as the comments in attach_signals indicate). You can do it for the entry and history widgets easily, you can do it for the entire window easily (I think, though that would also trigger for tabs other than the unread one), but I'm not sure how to do it for just the tab (other than just on the two widgets).

    Why are you trying to create a buddy list window? You also can't assign to gtkblist->window when gtkblist is NULL, as that is just going to crash.

     
  • Dale

    Dale - 2009-11-16

    Well I finally figured out what I was doing wrong.  I was trying to attach the GTK signals before there were any GTK windows (on plugin load).  So I moved the g_signal_connect calls to a function that is called upon first conversation creation and everything seems to work now.

    Thanks for the help.

    I uploaded the  and  in case anyone is interested.  I'll probably be modifying it some more over the next few days.

      : http://daleswanson.org/programs/reminder.c
      : http://daleswanson.org/programs/reminder.dll

     
  • Damberg

    Damberg - 2009-12-16

    Excellent plugin… but I can't get it to work. Nothing happens.

    Whats the time set for? Would it be possible to have some options to it? like setting another sound and choose time?

     
  • Dale

    Dale - 2009-12-17

    I really just made it for my personal use, so it's not polished at all.  I started to add options but realized I didn't care enough to waste any more time on it.  The time is hard coded at 5 seconds, and there is a delay before the first chime of 50 seconds.  The sound is the whatever sound you have set in the options for "Someone says your username in chat".  You can set that to any custom sound, but I liked the default for it.  Since I don't use chat this sound is never used otherwise.  You may have to enable that sound event for it to work (I just tested and you do have to enable it).

    It is unlikely I'll make options, however if you are interested I'd change the options and recompile it for you.  Just tell me what you want the seconds to be, and how long of a delay before the first chime sounds.

     
  • Damberg

    Damberg - 2009-12-17

    Ok. Actually had no sound on that event. So now it works! =)
    The initial time is ok, but the repeat time is a little too fast. 30 sec would do.

     
  • Dale

    Dale - 2009-12-18
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.