Results 1 to 4 of 4

Thread: [SOLVED] catch events

  1. #1
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    7

    Default [SOLVED] catch events

    Hello everybody,

    I'm new in Zimbra and I read all day documentations, source code, the wiki and this forum about programming Zimlets to provide new functionality to this marvellous application. I understand, that I can mark a special part of a message with a regular expression like a email address, a order number and what else or drop something on a icon to do some action.
    But I need to read some external sources as soon as the user clicks on the header of a message to open it for reading.
    Can a Zimlet catch this event and supply the sender address as well?
    If this is possible, can someone provide a snippet of code?
    Unfortunate I could not find anything about this issue in the documentation and every Zimlet I saw so far used a method I described above.
    Thanks in advanced.

    By Michael

  2. #2
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    7

    Default

    Hello again,

    today I had a closer look at the ZmZimletBase.js and the ZmMailMsg.js scripts. Voila I found the solution myself.
    There is a prototype in the ZmZimletBase.js named "onMsgView" which will called every time you view a new message.

    Here a example javascript:

    Code:
    function GetFromAddress() {
    }
    
    GetFromAddress.prototype = new ZmZimletBase();
    GetFromAddress.prototype.constructor = GetFromAddress;
    
    GetFromAddress.prototype.onMsgView =
    function(msg, oldMsg){
    	var from = msg.getAddress(AjxEmailAddress.FROM);
    	alert(from);
    };
    And the appropriate XML File:

    Code:
    <zimlet name="GetFromAddress" version="1.0" description="Get the sender address and print an alert">
    	<include>getFromAddress.js</include>
    	<handlerObject>GetFromAddress</handlerObject>
    	
    </zimlet>
    Hope this helps someone else...

  3. #3
    Join Date
    May 2009
    Posts
    48
    Rep Power
    6

    Default

    Quote Originally Posted by Liox View Post
    Hello again,

    today I had a closer look at the ZmZimletBase.js and the ZmMailMsg.js scripts. Voila I found the solution myself.
    There is a prototype in the ZmZimletBase.js named "onMsgView" which will called every time you view a new message.

    Here a example javascript:

    Code:
    function GetFromAddress() {
    }
    
    GetFromAddress.prototype = new ZmZimletBase();
    GetFromAddress.prototype.constructor = GetFromAddress;
    
    GetFromAddress.prototype.onMsgView =
    function(msg, oldMsg){
    	var from = msg.getAddress(AjxEmailAddress.FROM);
    	alert(from);
    };
    And the appropriate XML File:

    Code:
    <zimlet name="GetFromAddress" version="1.0" description="Get the sender address and print an alert">
    	<include>getFromAddress.js</include>
    	<handlerObject>GetFromAddress</handlerObject>
    	
    </zimlet>
    Hope this helps someone else...
    Hey Liox , Thanx for the post it helped me a lot ..
    But i didnt create a new zimlet for that ... Since its giving error after deploying .. I am new to zimlets . i created the XML and the JS file as you have posted ...
    Am getting the following error in mailbox.log

    2009-06-25 09:54:31,270 INFO [btpool0-7] [name=zimbra;ip=10.200.220.186;] soap - DeployZimletRequest
    2009-06-25 09:54:31,272 INFO [Thread-480] [] zimlet - deploy
    java.io.FileNotFoundException: zimlet description not found: GetFromAddress.xml
    at com.zimbra.cs.zimlet.ZimletFile.initZimletDescript ion(ZimletFile.java:199)
    at com.zimbra.cs.zimlet.ZimletFile.initialize(ZimletF ile.java:191)
    at com.zimbra.cs.zimlet.ZimletFile.<init>(ZimletFile. java:146)
    at com.zimbra.cs.service.admin.DeployZimlet$DeployThr ead.run(DeployZimlet.java:96)
    at java.lang.Thread.run(Thread.java:595)

    if u can plz explain me the above .

    so what i did is used the function in some other zimlet (ie i edited another zimlet ) and am getting the from address from there .

    Another Querry ::
    Is it possible to get the From address or the Subject without using the onMsgView Function .
    What would u suggest if i need these values(from and subject) inside an Already existing function .

    Many Thanx in Advance

  4. #4
    Join Date
    Jun 2009
    Location
    India
    Posts
    12
    Rep Power
    6

    Default

    Hello Friends,

    I am new bee in zimlet and need to implement zimlet to move duplicate emails to Duplicate folder.

    I have found one solution for develop zimlet in production environment with zimbra desktop.

    Please review below link which will help to develop zimlet in faster and easy way
    ZimletDevSetup - Zimbra :: Wiki

Similar Threads

  1. How to catch zimbra read mail events?
    By wangyugod in forum Developers
    Replies: 3
    Last Post: 10-27-2009, 08:16 PM
  2. Cannot Edit Events in a Shared Calendar
    By Chewie71 in forum Administrators
    Replies: 0
    Last Post: 09-17-2007, 11:09 AM
  3. Declined Calendar Events
    By soxfan in forum Administrators
    Replies: 0
    Last Post: 04-27-2007, 11:54 AM
  4. remove catch all account/alias
    By McPringle in forum Administrators
    Replies: 6
    Last Post: 02-09-2007, 01:24 PM
  5. ZCS iSync Connector 0.9.14 all-day events issue
    By pepijn in forum CalDAV / CardDAV / iSync
    Replies: 2
    Last Post: 10-03-2006, 11:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •