MozillaZine

Auto Hang Up after download

Discussion of features in Mozilla Thunderbird
richard_leeds

User avatar
 
Posts: 143
Joined: August 10th, 2006, 2:30 am
Location: UK

Post Posted August 14th, 2006, 3:34 am

Could we please have an option to auto Hang Up after download.

TB happily dials up to get messages if already offline, but then forgets to hang up afterwards. We need an option in Connection Settings:

Would be nice if TB wrote:Check box for "Hang up after download"

Secondary check box - "Ask before hang up" - sometimes I fire up TB to check emails, I might then check some stuff on the net, especially if one of the emails linked to to this forum! best to have the option for TB to ask as well as automatically killing the connection.

vjfromgt
 
Posts: 2
Joined: August 14th, 2006, 1:45 pm

Post Posted August 14th, 2006, 1:47 pm

uhhh,,, you mean Dial up still exist?
I was in Guyana last year (third world- one of the worste) and people were using dsl

richard_leeds

User avatar
 
Posts: 143
Joined: August 10th, 2006, 2:30 am
Location: UK

Post Posted August 15th, 2006, 2:14 am

vjfromgt wrote:uhhh,,, you mean Dial up still exist?


Broadband usage is something like 30% in UK and I imagine similar elsewhere. So that means 70% of users will need this feature.

Of those 30% who do have broadband, they will probably use dial up when away from base, unless they are in a WFi Hot Spot.

Old Ausdilecce
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted August 19th, 2006, 5:26 pm

Umm, yes, there are MANY parts of the world that do NOT have broadband yet..

Richard, the reason why Thunderbird does not have the "Auto hang up" option is because that is an MS windows specific option. Thunderbird is a multi platform application ( works with Windows, Mac, Linux, etc etc ) and coding specifically for windows OSs is not something that the devs want to persue.

I would imagine that there is a way to do it through an extension, and maybe someone could make that happen..

All that would be needed is
1) an extension that could "know" when all messages have been downloaded ( and sent )
2) when (1) is done, send a OS command to hang up the connection

It looks like the command for hanging up the connection depend on the Windows OS in question..

I have an existing extension that kinda "knows" when all messages have been downloaded so step 1 is kinda sorted
I would think that the command for step 2 would have to be hand entered by the user..

Windows NT, 2000, XP would use C:\{windowsDir}\system32\Rasphone.exe -h "connectionName"
Windows 95, 98 would have to use some third-party prgram ( like nircmd http://www.nirsoft.net/utils/nircmd.html ) to issue the hangup command

richard_leeds

User avatar
 
Posts: 143
Joined: August 10th, 2006, 2:30 am
Location: UK

Post Posted August 21st, 2006, 1:52 am

Thanks for the thoughts.

As for developers not wanting to do platform specific coding, they wrote a dial up routine for Windows so why not a hang up routine?

Presumably TB has some sort of property that says whether it is downloading or not? Well there must be, because the the status bar changes when downloading.

So, a simple extension would monitor that property every second, then ask if you want to disconnect.

Next thought is that one doesn't need to have the disconnect routine in the background all the time. So the easiset method would be to replace the existing "Get Mail" button with a new "Get Mail and hang up at the end" button. This would trigger the watch routine when pressed, then do the normal "Get Mail" routine. The watch routine would stop when mail had been downloaded.

The extension would include a similar tweak to the "work offline" command.
Last edited by richard_leeds on August 21st, 2006, 1:54 am, edited 1 time in total.

richard_leeds

User avatar
 
Posts: 143
Joined: August 10th, 2006, 2:30 am
Location: UK

Post Posted August 21st, 2006, 1:53 am

oops posted twice

Old Ausdilecce
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted August 21st, 2006, 2:21 pm

Sorry, but the devs did not write a dialup routine for windows.. that is part of the OS ( control panel..internet options...connections...neverdial//dial whenever network not present/always dial

There are several properties that say whether TB is downloading or not BUT *in between* individual messages, the 'downloading' property is false.. Also, it is possible to be fetching messages from several accounts in one go. In this case, TB serialises the fetches and between fetches for accounts, the 'downloading' property is false again..

Therefore, there needs to be checks on an interval to see if all downloading ( and uploading - in the case of unsent messages ) has been completed..

There are other issues to think about... If the user is using both TB and a web browser, and *accidentally* clicks the new Get Mail/hang up button - it will kill the connection... If this was done using OE and IE, IIRC a confirm box would appear...

IMO, instead of a new button ( which needs artwork, and support from the themers out there ) - it would be better to have a "Auto Disconnect when done" yes/no box appear when the user clicks Get Mail ( defaulted to No ) so the user has to do some extra work to force an auto-disconnect.

I would be interested in writing this extension BUT.. I have broadband and therefor cannot test the autodisconnect routine ( I can only see if it should be triggered ).

Would you volunteer to do that testing ?

Also, what OS do you have ?

Old Ausdilecce
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted August 21st, 2006, 6:44 pm

And, if the extension performs the hang up, should the extension then set TB's offline indicator to offline ?\


I should have a beta extension ready to test today...

Old Ausdilecce
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted August 21st, 2006, 7:59 pm

OK the extension is completed and *should* work...

The only problem is that I don't have dial-up..

So I need someone on dialup to test this extension..

Firstly, you will need to create a MSDOS batch file that will be able to reliably disconnect your dial-up connection
Second, after you install the extension AND restart TB, you will need to "point" the extension at that batch file by going into the extension's options and browsing for the batch file.. once the batch file's path is in the box AND you are on line, click the test button to see if it sucessfully disconnects you.

Depending on your operating system, one of the following commands *should* work

win95/98/2000/XP -

RunDll32.exe RASDLG.DLL,RasSrvHangupConnection

winXP option 2

RASDIAL.EXE [ConnectionName] /disconnect

where connection name is the name of connection as it appears in the RAS Phone book.. If you have only one ISP, the name can be omitted.. so examples are

RASDIAL.EXE "myISP" /disconnect
RASDIAL.EXE /disconnect

or you can try these:
Windows NT, 2000, XP would use C:\{windowsDir}\system32\Rasphone.exe -h "connectionName"
Windows 95, 98 would have to use some third-party prgram ( say with nircmd http://www.nirsoft.net/utils/nircmd.html , you would use {path}\nircmd.exe rashangup "connectionName" )

Get the beta AutoHangUp extension from > www.supportware.net/mozilla/AutoHangUp.xpi

richard_leeds

User avatar
 
Posts: 143
Joined: August 10th, 2006, 2:30 am
Location: UK

Post Posted August 22nd, 2006, 1:27 am

ausdilecce wrote:OK the extension is completed and *should* work...



Thanks - I'll have a play on my dial-up at home tonight.

I'm on XP (all service packs)

skydan
 
Posts: 2
Joined: August 22nd, 2006, 1:48 pm

Post Posted August 22nd, 2006, 2:08 pm

ausdilecce wrote:OK the extension is completed and *should* work...
The only problem is that I don't have dial-up..
So I need someone on dialup to test this extension..
...
Get the beta AutoHangUp extension from > www.supportware.net/mozilla/AutoHangUp.xpi

Great work. I have ADSL so it isn't much use to me but a friend (with dial-up) has been complaining that the new email progs can't do what we did routinely on the Amiga ten years ago! I'll have to get her to try it out.

If Thunderbird can control going online then it should control going offline. I am guessing, but it has enough information to know when there are no more messages to send or receive? POP tells you how many messages are waiting. SMTP is trickier unless the ISP provides an alternative channel to test for unreceived messages (my ISP provided a finger port on the mail server to display messages waiting).

An extra tick box on the dial-up dialogue makes sense, unless you are already online and wish to finish up the mail and go offline where an extra button would make sense here: go online unless already online, send/receive mail and go offline.

Old Ausdilecce
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted August 22nd, 2006, 2:38 pm

Thats just it.. Thunderbird *cannot* control going 'online' ( online in the sense that it dials a ISP )

The OS controls dialing an ISP... Basically, if the *control panel...internet options...connections* is set to dial either "whenever network not present" or "always dial" and an application ( any application) attempts to use internet resources ( an ip address ) then the dialer will appear.

Pop does indeed tell TB how many messages are waiting *after* TB connects to your mail server and polls it. TB also gets a rough idea of how many bytes are sitting there. Then, according to settings the user set in the account's options, it will either autodownload those messages, or just the headers or whatever.

What the extension does is simply poll the accounts in question and if one shows busy, it will pop up a box to ask the user if it should hang up the connection when the account is no longer busy.. Then, when *all* accounts are not showing busy, it will run whatever commandfile you specified in the extension's options...

The dialup dialog is an OS dialog, *NOT* a TB dialog..

richard_leeds

User avatar
 
Posts: 143
Joined: August 10th, 2006, 2:30 am
Location: UK

Post Posted August 22nd, 2006, 2:42 pm

It works!

Had a small hitch creating the batch file.. I did it in Notepad which stuck a txt suffix on the end, so I had a file called hangup.bat.txt... windows explorer is so idiot proof that it wouldn't let me change the suffix! Created the file in my HTML editor.

Firstly the command I used was "RASDIAL.EXE /disconnect"

Secondly, it worked the first time I downloaded messages, but then my POP server was empty. I tried it with sending a couple of emails and it worked. I'll need more time to go online, send myself emails from an external webmail account and also create some outgoing emails. Then I need to do a "Get Mail", do a dial up ..... groan .... the joys of dial up!

Anyway, principle is proven, just need more test runs

Tips for making it user friendly:

- Include batch files in the xpi for typical set up ... all XP users could use the one I did, perhaps a NT /2000 option for backward compatibility? (plus instructions if someone wants to write their own)

- The batch file opens a DOS window - can this be hidden?

- The hang up prompt needs to keep in the front since the dial up box popped up in front of it

- After closing the hang up prompt, the dial up dialogue should go to the front. At one point mine was hidden.

- Set TB status to offline once the connection is hung up

- Eeither clicking on the online icon (bottom left) or menu option to go offline both force hang up. This covers situations where the user has stayed online.

- Triggering the batch file when already offline doesn't cause any error message, so fortunately error handling won't be required!

Old Ausdilecce
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted August 22nd, 2006, 2:59 pm

richard_leeds wrote:It works!

Had a small hitch creating the batch file.. I did it in Notepad which stuck a txt suffix on the end, so I had a file called hangup.bat.txt... windows explorer is so idiot proof that it wouldn't let me change the suffix! Created the file in my HTML editor.

In order to save a file from notepad (or any other app that auto appends a suffix) and preserve the suffix, simple surround the whole filename and suffix in double quotes
Like:
"hangup.bat"

richard_leeds wrote:Firstly the command I used was "RASDIAL.EXE /disconnect"

Secondly, it worked the first time I downloaded messages, but then my POP server was empty. I tried it with sending a couple of emails and it worked. I'll need more time to go online, send myself emails from an external webmail account and also create some outgoing emails. Then I need to do a "Get Mail", do a dial up ..... groan .... the joys of dial up!

Anyway, principle is proven, just need more test runs

Tips for making it user friendly:

- Include batch files in the xpi for typical set up ... all XP users could use the one I did, perhaps a NT /2000 option for backward compatibility? (plus instructions if someone wants to write their own)

The problem is that I need *you guys* to tell me what batch commands work correctly. I don't have dial-up nor several different versions of windows to test on

richard_leeds wrote:- The batch file opens a DOS window - can this be hidden?

I don't think so, but if you adjust your commands in the batch file the Dos window will just flash... so if you used "RASDIAL.EXE /disconnect" try

start RASDIAL.EXE /disconnect
exit


The start command will tell your os to start the program (rasdial) in a separate thread and dont wait for completion
the exit command will kill the dos window

richard_leeds wrote:- The hang up prompt needs to keep in the front since the dial up box popped up in front of it

Hmm, this is a problem... gotta think about that one... focus is very hard to pre-plan, especially if the OS does stuff TB has no control over

richard_leeds wrote:- After closing the hang up prompt, the dial up dialogue should go to the front. At one point mine was hidden.

The dialup dialog is part of windows and the hang up prompt is part of TB. If you give focus to the hang up prompt, you are giving focus to the whole TB app, which will "hide" the dialup prompt.. this goes hand in hand with your previous point..

richard_leeds wrote:- Set TB status to offline once the connection is hung up

This is part of the extension already, but it is somewhat 'hidden'. To set this option, edit your prefs.js file and insert of change the line to match the following:

user_pref("autohangup.setTBoffline", true);

richard_leeds wrote:- Eeither clicking on the online icon (bottom left) or menu option to go offline both force hang up. This covers situations where the user has stayed online.

Are you saying that's how it should be ?

richard_leeds wrote:- Triggering the batch file when already offline doesn't cause any error message, so fortunately error handling won't be required!

Understood

richard_leeds

User avatar
 
Posts: 143
Joined: August 10th, 2006, 2:30 am
Location: UK

Post Posted August 23rd, 2006, 2:20 am

ausdilecce wrote:Hmm, this is a problem... gotta think about that one... focus is very hard to pre-plan, especially if the OS does stuff TB has no control over

.....

The dialup dialog is part of windows and the hang up prompt is part of TB. If you give focus to the hang up prompt, you are giving focus to the whole TB app, which will "hide" the dialup prompt.. this goes hand in hand with your previous point..


hmm.... we need AutoHangUp to ask the question BEFORE the OS connection is requested.

There must be some call (or trigger or event whatever it's called) from TB to the OS connection routine that says "get me connected". Then the OS goes through the dial up routine.

Is it possible for AutoHangUp to intercept that call from TB to the OS? Then AutoHangUp says to TB "what a second I've got to ask a question", then once the user has answered, AutoHangUp says to TB "OK, go ahead with what you were doing, ie request a connection from the OS".

I guess there are several ways of doing this:

1) Replace the TB coding that says "Call the OS to make the connection" with "call AutoHangUp and once AutoHangUp is ready then call the OS to make the connection"

2) Make AutoHangUp a middle man so TB calls AutoHangUp to make the connection, AutoHangUp asks the question and then passes on the request for a connection to the OS

3) A watch on a property that changes when the users clicks "Get Mail", AutoHangUp jumps in, pauses TB, asks the question, then lets TB carry on.

4) Is it possible to change the the action of the "Get Mail" command or button so it calls AutoHangUp instead? Then AutoHangUp passes on the "Get Mail" command to TB? I think we should have a chat with that chap who did that helpful "GetAllMail" button ;)

5) others that I can't even imagine.....




richard_leeds wrote:- Eeither clicking on the online icon (bottom left) or menu option to go offline both force hang up. This covers situations where the user has stayed online.

ausdilecce wrote:Are you saying that's how it should be ?


I'm suggesting there could also be a manual trigger for the hang up as well as the automatic one. This would watch the online status, when the user changed to offline, it would trigger the hangup command. I appreciate not everyone would want that by default, but it's the behaviour most dial up users would expect when selecting "offline". There would be an option in the extensions to:

[ ] Hang up automatically when going offline (Default option)
[ ] Ask the user if they want to hang up each time they go offline
[ ] Turn off the feature

To be honest, I'm impressed you jumped stright to the automatic version! A simple "when TB goes offline, make the connection offline as well" would have made me quite happy.

Return to Thunderbird Features


Who is online

Users browsing this forum: No registered users and 1 guest