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.
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.
Quick links
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
or the larger flashing, you've-got-private-messages icon
.
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:
imsg1.gif - no unread IMs
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.
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.
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.![]()
Now enter a name for the shortcut on the desktop
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".![]()
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:![]()
Double-click this icon to launch the program. To kill the program, simply click on the taskbar icon and type control-C.![]()
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
-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). Note that the program won't allow query intervals less than 60 seconds; this is an unreasonable use of DSLR webserver resources. |
-D | Show a bit of debugging information, which is probably not intersting to anybody but a developer. |
-? | Show a brief summary of cmdline parameters |
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.![]()
![]()
![]()
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. 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.
Do I need to give it my DSLR password? | |
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. | |
  | |
Do I need to have my browser open to use this program? | |
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. | |
  | |
I used to have your old dslrim program but want to use this new one. Can I uninstall the old one? | |
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. | |
  | |
It doesn't work. | |
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
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. | |
  | |
I got a PM but it never dinged. Why not? | |
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. | |
  | |
Will this program keep nagging me over and over to read the same pending PM? | |
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. | |
  | |
Does this program take up many resources? | |
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. | |
  | |
Can I check for PMs of other people? | |
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. | |
  | |
I love this program - how can I thank you? | |
We take tool points ![]() |
Navigate: More Tools