The Artima Developer Community
Sponsored Link

Python Buzz Forum
Hacking Pidgin to only flash the tray icon when your nick is mentioned in a chat

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Phillip Pearson

Posts: 1083
Nickname: myelin
Registered: Aug, 2003

Phillip Pearson is a Python hacker from New Zealand
Hacking Pidgin to only flash the tray icon when your nick is mentioned in a chat Posted: Jun 3, 2008 7:09 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Phillip Pearson.
Original Post: Hacking Pidgin to only flash the tray icon when your nick is mentioned in a chat
Feed Title: Second p0st
Feed URL: http://www.myelin.co.nz/post/rss.xml
Feed Description: Tech notes and web hackery from the guy that brought you bzero, Python Community Server, the Blogging Ecosystem and the Internet Topic Exchange
Latest Python Buzz Posts
Latest Python Buzz Posts by Phillip Pearson
Latest Posts From Second p0st

Advertisement
Pidgin is awesome - it's a cross-platform IM client (I'm running it on Windows) for pretty much every IM network except Skype. One thing I've wanted to change for a while is the 'blink window on received message' function; many of my coworkers are using Adium or iChat or some other OS X app that only tries to grab your attention if (a) you receive a personal IM, or (b) your username is mentioned in a chat.

Here are some notes about the process, to refresh my memory if I come back to this in a few months' time, or maybe to help others get into the Pidgin code, if anyone is working in a similar area...

It's surprisingly easy (for a project with so many dependencies) to get up and running with a build environment on Windows. Once you've got Cygwin installed, there's a script that will fetch all the build deps and the latest source for you, then you're ready to go with make -f Makefile.mingw install.

There are two hooks that result in the window being flashed; the prefs (see prefs.xml in your .purple directory) are called /pidgin/win32/blink_im (which, if set, blinks the window when you get a private message) and /plugins/gtk/purplerc/win32/winprefs/chat_blink (which, if set, blinks the window when you get a message in a chat). Not sure why one is a main Pidgin setting and one is inside the gtk plugin, but there you go.

The Tools | Preferences | Conversations | Flash window when IMs are received option is set in pidgin/gtkprefs.c.

The Tools | Plugins | Windows Pidgin Options | Flash window when chat messages are received option is set in pidgin/plugins/win32/winprefs/winprefs.c. I wonder if this could be moved into the Conversations config pane?

Another interesting option is Tools | Preferences | Sounds | Someone says your username in chat (set in finch/gntsound.c and pidgin/gtksound.c), which plays a sound when someone says your name. I normally work with sounds turned off, though.

Here's my patch to add an option to the Windows plugin to flash the window when your username is mentioned. I also get it to flash the window if someone says phil, myelin or pearsonp; you'll probably want to remove that bit from the patch.

diff -r pidgin-2.4.2/pidgin/plugins/win32/winprefs/winprefs.c ../pidgin-2.4.2/pidgin/plugins/win32/winprefs/winprefs.c
58a59
> static const char *PREF_CHAT_BLINK_NAME = "/plugins/gtk/win32/winprefs/chat_blink_name";
236c237,249
< if(purple_prefs_get_bool(PREF_CHAT_BLINK))
---
> if(purple_prefs_get_bool(PREF_CHAT_BLINK_NAME)) {
> PurpleConvChat *chat = purple_conversation_get_chat_data(conv);
> purple_debug_info("winprefs", "Received a message from %s (I am %s, nick %s): %s\n", who, account->username, chat->nick, *message);
>
> if((account->username != NULL && purple_utf8_has_word(*message, account->username))
> || (chat != NULL && chat->nick != NULL && purple_utf8_has_word(*message, chat->nick))
> || purple_utf8_has_word(*message, "phil")
> || purple_utf8_has_word(*message, "myelin")
> || purple_utf8_has_word(*message, "pearsonp")) {
> purple_debug_info("winprefs", "Chat message contains a string we're looking for: blinking window.\n");
> winpidgin_conv_blink(conv, flags);
> }
> } else if(purple_prefs_get_bool(PREF_CHAT_BLINK))
342a356,357
> pidgin_prefs_checkbox(_("_Flash window when your username is mentioned in a chat message"),
> PREF_CHAT_BLINK_NAME, vbox);

Comment

Read: Hacking Pidgin to only flash the tray icon when your nick is mentioned in a chat

Topic: Softest. Shoes. EVAR. Previous Topic   Next Topic Topic: A Single Command to Get Started on Functional Programming

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use