Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 23rd, 2004, 1:17 PM   #1
Lance
Programmer
 
Lance's Avatar
 
Join Date: Oct 2004
Location: Chicago, IL USA
Posts: 74
Rep Power: 4 Lance is on a distinguished road
Send a message via AIM to Lance
So I use GeekTool (an app that let's me print command output right onto my root window, like root-tail and I wanted to have a simple notifier. I don't want a notifier that takes up menubar space on my already-small 12" screen, and they launch a web browser anyways, while I use Mail.app for POP3 Gmail. So I wrote some simple code for GeekTool:

print "G" if `curl -su <USER>:<PASSWORD> https://gmail.google.com/gmail/feed/atom` =~ /<entry>/

You can then just set GeekTool to run the file containing this command, or use perl -e to execute it right from GeekTool. Same with root-tail, I suppose.

Why did I post this? I have no clue, it's just interesting. A snipplet of code that others can probably use to their advantage, or even get more creative with it.

But there is also a POP3 version, if you like that more:

#!/usr/bin/perl
use Mail::POP3Client;

$pop = new Mail::POP3Client( 
 * * * *USER * * => $ENV{GMAIL_USER},
 * * * *PASSWORD => $ENV{GMAIL_PASS},
 * * * *HOST * * => "smtp.gmail.com",
 * * * *PORT * * => 995,
 * * * *USESSL * => 'true', *
 * * * *);
 
my $count = $pop->Count;
my $plural = $count == 1 ? [ 'is', '' ] : [ 'are', 's' ];

print "$ENV{GMAIL_USER}: There $$plural[0] $count" .
 *" message$$plural[1]\n";
 * * * *
$pop->Close();

It was found at the O'Reilly's Developer Weblog, if you're curious.

Anyone got other spiffy ideas on how to implement unobtrusive Gmail notifiers?

</randomRant>
__________________
/* LANCE */
C++;  /* this makes C bigger but returns the old value */
char *site = "slackwise.net",
     *home = "lance.slackwise.net",
     *pics = "flickr.com/photos/slackwise";
Lance is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:25 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC