I am trying to make a plugin for email. I hope that after myplugin being loaded in the server I can send &reciv email throug spark. up unitl now I have learned JAVAMAIL.but I found that the comunication inside the openfir a bit complex,I mean I don’t konw what openfire doing when I submmit an order for sending email .I know there is openfire DOC &how to devp your own plugins guide on the web.But there are thounds of APIS Classes in openfire,where is the breakpoint?which class should I use first ?
I assume you want something like a Bot, that means a “contact” in your contact list that accepts several commands for sending and browsing your emails. E.g. something like:
sendmail -to alice@example.com -subject "Hello!"
Hi, how are you? :)
Send a new email from default address. Everything after the first line break is interpreted as mail body.
checkmail
receive a list of new mails (id/from/subject/date)
read <id>
read mail with ID
This is easy to use (for users that are familiar with console usage ) and, because its based on simple text messages, it should be supported from all jabber clients. Everything you need is some virtual JabberID with processes your commands.
You could start with implementing the Component interface. Method processPacket(Packet packet) is called if someone sends a message to your component. Make sure calls to this method are thread safe and non-blocking.
However you will need some kind of mechanism so users can add your bot/component to their contact list. Otherwise the contact would be always shown as offline. I recommend to check out source code of my Helga Bot, where HelgaPresenceHandler does this part. Other utilities like the Command Parser or the internal event system (to check emails automatically) are maybe also useful for you.
There is also an extra library for writing Bots. But I’m not familiar with this:
Just to add to what Coolcat already wrote, if you haven’t already done so download the Openfire source, which includes not only the source to Openfire but to most all the existing plugins as well. Looking at the source the existing plugins, reading the Openfire: Plugin Development Guide and a blog post or two should help you get started.