Does this site look plain?

This site uses advanced css techniques

[YGPM Logo]

YGPM — You've Got Private Messages

This small C++ program checks for unread instant messages at DSL Reports, our favorite community web site. Many of us who hang out at DSLR spend more time than we should just waiting for people to send us messages. It's a great way to burn a lot of time.

Table of Contents

So instead this program just sits in the background and checks for unread IMs, popping up a dialog box when they arrive. No need for a browser to be open, no need to watch anything. It's been remarkably effective at replacing the frequent and pointless distractions of checking for IMs with the less common and slightly less pointless distraction of actually reading those IMs.

This program replaces dslrim, a perl version that worked but was very cumbersome to install on the Windows platform. And unlike the perl version, ygpm appears to work on Windows 95/98/ME/NT/2000/XP. It's very small, and the same code compiles on Linux and other UNIX platforms. Full source code is provided.

Disclaimer - this tool is a private effort and is not endorsed, authorized, or otherwise commented on by DSL Reports management. As always, I speak for me only.


How it works

Justin implemented a new /instantcheck/ mechanism on the server that allows for much easier checking of IMs remotely (announced in this thread). By fetching a page via a URL with our own DSLR user number, get either the small IM icon No IMs waiting or the larger flashing, you've-got-private-messages icon IMs waiting.

The pages returned are extremely simple, differing only in the image returned. The URL by itself can be used for an on-screen IM indicator, and we suspect that a bit of javascript could be used to create a tiny window without all the standard browser accouterments. But this requires desktop real estate and a bit of a diversion to look at it from time to time: we prefer a synchronous notification of IMs that is entirely out of the picture until IMs arrive.

So we fetch the same URL over and over - every minute or so - and look at the image found inside the page. These images are:

No IMs available   imsg1.gif - no unread IMs
IMs available imsg.gif - unread IMs are available

When we see the you-have-IMs indicator, we cause a user notification (see below), but suppress additional notifications until the IMs have been read. If the user is away from his desk when IMs are available, we don't want to fill the screen with "You have IMs!" messages each minute until the user returns.

User Notifications

Notifications on the Windows platform are done via a system modal dialog box that reports that you have private messages:

[YGPM Popup]

Under Linux it does little more than display a message to the console, but the entire notify mechanism is extensible by the user without having to recompile anything.

The -N command line parameter is followed by the name of a program to run when PMs are received: the program is called with two parameters: the user number and the display name, and the program may do whatever it likes with that data. It's run with the system() mechanism. The YGPM program allows the notify program to suspend until the user has dismissed the notification.

Installation for Windows

To install this program, simply copy the executable (YTGM.EXE) into a directory somewhere - it need not be in the command execution path - and create a shortcut for it by right-clicking on the desktop:

YGPM-create shortcut

Enter or browse to the YGPM.EXE executable that you saved (your path may differ from ours), and be sure to put the full executable name in double quotes. Add your DSLR user information after a "-u" parameter in the form -u 340145:Steve.

YGPM-shortcut location

Now enter a name for the shortcut on the desktop

YGPM-shortcut name

Now there is an icon on the desktop showing the familiar DSLR yellow envelope: just one more step. Right-click on the shortcut and select "Properties".

YGPM-run minimized

You'll see most of your parameters filled in already (and you can change them here), but look at the Run drop-down box and select Minimized. When YGPM is started, this causes the console windows to be minimized to the task bar, saving you that one small step. Click OK to finish, leaving your icon sitting there:

Click OK to finish, and this completes installation of the program. You should see an icon sitting on your desktop:

YGPM shortcut on desktop

Double-click this icon to launch the program. To kill the program, simply click on the taskbar icon and type control-C.

Installation on UNIX/Linux

Though this program is usable under UNIX/Linux, it's not so clear it is really that useful. The perl version is just as functional and much easier to configure, and we are not sure we care to provide full compilation instructions for the C version. Those who really wish to give it a go are welcome to download the source and try.

Query Intervals

By default, ygpm checks the DSLR server once every sixty seconds looking for unread IMs. This setting corresponds with Justin's auto-refresh value in the web page fetched from the instantcheck HTML - this suggests that this refresh value won't tax the servers too badly.

The interval can be changed with the -i ## command-line parameter (default is -i 60), but this probably shouldn't be made smaller without a really good reason. An every-sixty-second check means that (on average) you'll be notified 30 seconds after a new IM arrives. If you need to be notified more rapidly than that, it means you probably need some time away from DSL Reports.

Command Line

A few options are available on the command line:

-u ###:Name
Specify a DSL Reports user number (usually six digits). This number can be found by putting your mouse pointer over a person's avatar in any post and looking at the URL selected: the digits are the user number.
The DSLR user name can be specified after the user number by putting a colon between them: this makes for a more pleasing display of the user name. If the display name is not given, the user number is used instead.
We use -u 340145:Steve for this parameter.
-p PXY
Specify PXY as a proxy server to use in the form http://proxy.url.com:8080/. If the port number is not specified, 8080 is assumed.
-i ###
Specify the query interval in seconds, default = 60. Tokens of s, m, and h can be given after the digits to indicate seconds, minutes, and hours (respectively).
-D
Show a bit of debugging information, which is probably not interesting to anybody but a developer.
-?
Show a brief summary of cmdline parameters

Finding your DLSR User ID

Your DSL Reports user ID is a six digit number (unless you're Justin, in which case it's "1"), and it's easily found in your profile. Click on "Members" and "Account" in the left nav bar. Your ID is shown at the top of the profile page:

BBR Members link * BBR User ID

This shows the DSL Reports user ID of 340145. You'll use this number (but not my number) in the command line that launches YGPM. -u 340145:Steve is used in our configuration.

Download

The program and source code can be found on this web server:

Source Code

All the software is written in portable C++, and it compiles without warnings using Microsoft Visual C++ and with the GNU C compiler on Linux. We expect to find minor portability issues on other platforms but they will be easy to resolve.

Even under Windows, this program is built in a command-line environment - no MSVC "project file" - and we do require the use of GNU Make (gmake.exe). We prefer to have a single makefile for all our builds, and Microsoft's NMAKE is just too hideous. A build of GNU Make (3.79) can be found on this web server as gmake.exe. This is the same binary I use for my own development.

Stuff still not done

Frequently Asked Questions

Q - Do I need to give it my DSLR password?
A - NO! This program only checks for the existance of personal messages, not their contents, and at no time does YGPM "log in" to your account. You should not be giving your DSLR password to anybody.
 
Q - Do I need to have my browser open to use this program?
A - Not at all. This has nothing to do with the browser, and it follows that you don't have to be logged into DSLR either.
 
Q - I used to have your old dslrim program but want to use this new one. Can I uninstall the old one?
A - Sure enough. In particular, you can uninstall ActiveState perl, though there is no real harm in leaving it on your system. The new program doesn't interact with one single bit of the old one.
 
Q - It doesn't work.
A - The most common reason we've seen is that you neglected to provide your DSLR user number in the shortcut. This is where you should have added something like -u 340145:Steve to the YGPM shortcut. If you never did this step, it can't possibly work.

Alternately, we've seen problems with getting the pathnames wrong. If you store YGPM.EXE in a directory with spaces in the name, you have to put double quotes around the whole path. This means that you command line might be:

"C:\Program Files\DSLR\YGPM.EXE" -u 340145:Steve

This puts quotes around the pathname of the executable, but leaves the rest alone.

 
Q - I got a PM but it never dinged. Why not?
A - YGPM queries for unread PMs roughly once per minute. If you see the blinking PM indicator and read that message between checks, it won't ever see an unread message to tell you about. This is normal.
 
Q - Will this program keep nagging me over and over to read the same pending PM?
A - No. The first time YGPM sees that you have an unread PM, it notifies you via the popup mechanism. Once you acknowledge that notification, it continues to check for PMs, but it won't notify you again until it sees a "you have no PMs" condition. Once it knows you've read your PMs, then it's free to tell you the next time one arrives.
 
Q - Does this program take up many resources?
A - We think not. The executable is very small (now about 24 kbytes) and spends most of its time simply waiting for things to happen, and we've not been able to really measure any meaningful CPU time usage. It's very lightweight.
 
Q - Can I check for PMs of other people?
A - Technically yes, but it seems really rude to us. And all you can do is recognize they have one or more unread PMs, not whether they have read yours or not. This seems like a bad idea.
 
Q - I love this program - how can I thank you?
A - We take tool points :-)

Revision History