BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 04-20-2005, 04:43 PM   #1 (permalink)
New Member
 
Ragnorok's Avatar
 
Join Date: Apr 2005
Location: Nashua, NH
Model: Vario
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Edit message after user hits "send", but before it's sent...

Please Login to Remove!

- I have a requirement to present a dialog to the user *after* they hit send on a RIM unit. The response to this dialog will then be used to modify the contents of the message, and it may or may not add BCC recipients.
- RIM says this can't be done ... once the user hits send, it queues the message and it's impossible to interact with it after that. (sigh)
- But since RIM isn't all-knowing, it doesn't hurt to see if anyone out there the BF.com Land may have any pearls of wisdom on the subject.
- I've put in every single listener I could find, just to map the order that they occur, since that seemed to be a secret, and found nothing that would trigger at the appropriate time. When anything does trigger, I cannot edit the message itself.
- So I'm currently copying the message in the listener and deleting the original. Then I can do what I want with the copy, and send it when I'm good and ready. This, however, sporadically generates two messages to the recipients, because every now and again the copy doesn't process to allow the orginal to be deleted before it leaves the unit.
- Either of two things will work:
1) Edit the original mail before it's sent.
2) Reliably prevent send of the original mail to allow the copy and delete to proceed consistently.
- Any ideas?
- Thanks for your time...
Offline  
Old 04-20-2005, 06:39 PM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Feb 2005
Model: 7280
Carrier: cingular, no wait, AT&T
Posts: 300
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

What you want is impossible.
Register an item in the mail program's menu, call it "Send with extra special magic" or whatever. You will be passed the email as a context object. (3.7 has a serious bug though, in that you *won't* be passed the proper email under some circumstances).
On 3.7, I revert to screenscraping. On 3.8+, I can rely on the menu item invocation's context object.

And trust me, what you want is impossible. I've been there.
Edit: By screenscrape, I mean I grab the current Screen object, iterate through all the fields, recreating the message from scratch (lots of strcmps to see if the current field is the subject line, To line, or whatever). I make a new message object, and then do my special voodoo on that copy. Send the new one, and the old one is forgotten. Also, in replies/forwards, the Original Messages bit isn't part of the body. I use a special screenscraper for that.

Last edited by DoomBringer : 04-20-2005 at 06:43 PM.
Offline  
Old 04-21-2005, 08:34 AM   #3 (permalink)
BlackBerry Extraordinaire
 
Join Date: Dec 2004
Location: in a house...
Model: lots
Carrier: Rogers
Posts: 1,148
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there no way to overload the "Send" menu item in the context menu and then have it run your code before doing an actual send?
Offline  
Old 04-21-2005, 08:58 AM   #4 (permalink)
New Member
 
Ragnorok's Avatar
 
Join Date: Apr 2005
Location: Nashua, NH
Model: Vario
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Screen scraping ... interesting...

- Impossible. Roit. (sigh)
- Never thought of screen scraping, actually, but it may be acceptable to just use the "Send with vodoo" button. I'll run that by The Powers That Be and see what they have to say about that.
- But I'm still intrigued. Could you give an overview of how you do screen scraping on a RIM unit? Just as a fallback in case the "Send with vodoo" menu option isn't acceptable.
- BTW, we're running v4 on all units for this project, so I shouldn't have to worry about the context. Shouldn't, I say. (wink)
- I know of no way to "overload" an existing application's menu option. It will simply add another "Send", leading to confusion for the poor user. At least that's what I *think* will happen; I asked RIM about doing just that and got a negative response.
- Thanks for your time...
Offline  
Old 04-21-2005, 10:17 AM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2005
Location: Atlanta, GA
Model: 8300
Carrier: tmo
Posts: 102
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

doomB- I am pretty sure your problem with 3.7 is predictable. It's due to a bug in early releases of 3.6 and 3.7 that is corrected by the Blackberry API Patch that is available on the BB web site.

I check the version of the messaging api, and if it isn't at least the patch version, won't run. Not as friendly, but cleaner code, and the context is always good.

I have also tried to hook Send. I tried everything - even things way uglier than "screen scraping". Never could make it happen...

jeff
Offline  
Old 04-22-2005, 12:23 PM   #6 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Feb 2005
Model: 7280
Carrier: cingular, no wait, AT&T
Posts: 300
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Ragnorok
- Impossible. Roit. (sigh)
- Never thought of screen scraping, actually, but it may be acceptable to just use the "Send with vodoo" button. I'll run that by The Powers That Be and see what they have to say about that.
- But I'm still intrigued. Could you give an overview of how you do screen scraping on a RIM unit? Just as a fallback in case the "Send with vodoo" menu option isn't acceptable.
- BTW, we're running v4 on all units for this project, so I shouldn't have to worry about the context. Shouldn't, I say. (wink)
- I know of no way to "overload" an existing application's menu option. It will simply add another "Send", leading to confusion for the poor user. At least that's what I *think* will happen; I asked RIM about doing just that and got a negative response.
- Thanks for your time...
There isn't a way to overload a built in menu, I would assume. RIM wouldn't take too kindly to that.
Adding your own menu entry to the email application is pretty easy though, and you can specify whether to show in compose or view individually. This is the *only* option for what you want. You cannot get your code to run when the user clicks "Send". It is just not possible. If the suits tell you to make your code run when the user clicks "Send" instead of your own custom menu entry, tell them to call RIM. Hell, you can't even do this in other email clients, like Outlook or Notes, IIRC, and neither would you want to. It is not a good idea to pull the rug out from under the user and make things not work the way they expect. Also, if your code breaks, the end-user might very well call RIM, and then they'll be po'ed at you.
In short, it is impossible. RIM designed the thing to be "unhackable" or whatever, so that means you can't change the plumbing of the thing very much.
Since you're running on all OS4 devices, don't worry about screenscraping too much. One thing to watch out for is replies and forwards though... because the device uses CMIME, the original message block *isn't* part of the body text. (CMIME only sends the ID of the message to include as an original message) Thus, you need to screen scrape that.
Screen scraping is pretty painful, and it can't be very good for performance... but I have to make do. I've gotten my routines down to an art, but I can't share. Some hints though:
Get the current screen object by calling net.rim.device.api.ui.UiApplication.getActiveScree n. Screen IS_A Manager, so you can get a field count and go through each field on the screen. The to, cc, and bcc fields are a subclass of HorizontalFieldManager, the subject is a LabelField (I think), the body is an autotext edit field and can be detected because it is preceded by a SeparatorField (and there can be more than one body field...), the Original Messages block is a VerticalFieldManager, and attachments are shown after another separator field.
The VFM has label fields, edit fields, and datefields.
The debugger is most helpful in this. Make a basic application, and get the current screen object. Just go through the hierarchy of objects in the screen.
Yes, I know quite a lot about this stuff. Because I've spent hours going through the debugger to find what I want.
Offline  
Old 08-30-2007, 01:37 PM   #7 (permalink)
New Member
 
Join Date: Aug 2007
Model: 8707g
PIN: N/A
Carrier: programmeur
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default SendListener

Implement SendListener.

Add this listener to your default store.
Offline  
Closed Thread


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Reconditioned Windsor Commodore 20 Carpet Extractor
$3025.0
Reconditioned Windsor Commodore 20 Carpet Extractor pictureWindsor Commodore Duo
$3500.0
Windsor Commodore Duo pictureJelenko commodore VPF porcelain furnace
$650.0
Jelenko commodore VPF porcelain furnace pictureWINDSOR Commodore CMD Carpet Extractor Cleaning Machine 0541 Hours WORKING
$424.99
WINDSOR Commodore CMD Carpet Extractor Cleaning Machine 0541 Hours WORKING pictureComfort Products 60-5800T Commodore II Oversize Leather Chair with Adjust... New
$212.99
Comfort Products 60-5800T Commodore II Oversize Leather Chair with Adjust... New picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.