|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsiuying.gm.GMConnector
public class GMConnector
Main class to establish connection to GMail and perform actions Since 0.3.6, underlying HTTP is done by Multi-Threaded HTTPClient Thus multiple request can be sent at same time
| Field Summary | |
|---|---|
protected static java.lang.String |
LINK_ATTACHMENT
|
protected static java.lang.String |
LINK_GMAIL
|
protected static java.lang.String |
LINK_LOGIN
|
protected static java.lang.String |
LINK_LOGIN2
|
protected static java.lang.String |
LINK_LOGOUT
|
protected static java.lang.String |
LINK_REFER
|
protected static int |
LOGON_PORT
|
protected static java.lang.String |
LOGON_SITE
|
protected static int |
STATUS_CONNECTED
|
protected static int |
STATUS_INITED
|
protected static int |
STATUS_NOT_INIT
|
protected static java.lang.String |
USER_AGENT
|
protected static java.lang.String |
VER
|
| Constructor Summary | |
|---|---|
GMConnector()
Create an GMConnector object to connect and request gmail for various tasks |
|
GMConnector(java.lang.String user,
java.lang.String passwd,
int tz)
Create an GMConnector object to connect and request gmail for various tasks |
|
| Method Summary | |
|---|---|
boolean |
connect()
Connect and login to gmail |
void |
disconnect()
disconnect to gmail network |
java.lang.String |
fetchOriginalMail(java.lang.String id)
Request gmail for the original source of the email Use this method if you do NOT want to get the gmail/gmailer processed message and instead get the untouched form of the original message |
java.io.InputStream |
getAttachmentAsStream(java.lang.String attid,
java.lang.String msgid)
Open an Attachment in GMal as an InputStream |
GMContact[] |
getContact(int type,
java.lang.String search)
Request GMail for list of contacts |
org.apache.commons.httpclient.HttpClient |
getHttpClient()
|
java.lang.String |
getPasswd()
Get password of the connection |
java.lang.String |
getProxyHost()
Get proxy host address |
int |
getProxyPort()
Get the proxy host port |
java.lang.String |
getTimezone()
Get timezone of the connection |
java.lang.String |
getUser()
Get username of the connection |
boolean |
isConnected()
Check if we had connected to gmail |
GMResponse |
request(byte type,
java.lang.String box,
java.lang.String pos)
Send request to gmail |
GMResponse |
request(byte type,
java.lang.String box,
java.lang.String pos,
java.lang.String[] msgs)
Send request to gmail |
boolean |
send(GMSendMailBody mailbody)
|
void |
setPasswd(java.lang.String passwd)
Get password of the connection |
void |
setProxy(java.lang.String phost,
int pport)
Set the HTTP proxy host address and port |
void |
setTimezone(java.lang.String timezone)
Set timezone of the connection |
void |
setUser(java.lang.String user)
Set username of the connection |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String LINK_GMAIL
protected static final java.lang.String LINK_LOGIN
protected static final java.lang.String LINK_LOGOUT
protected static final java.lang.String LINK_LOGIN2
protected static final java.lang.String LINK_REFER
protected static final java.lang.String LINK_ATTACHMENT
protected static final java.lang.String USER_AGENT
protected static final java.lang.String VER
protected static final java.lang.String LOGON_SITE
protected static final int LOGON_PORT
protected static final int STATUS_NOT_INIT
protected static final int STATUS_INITED
protected static final int STATUS_CONNECTED
| Constructor Detail |
|---|
public GMConnector()
public GMConnector(java.lang.String user,
java.lang.String passwd,
int tz)
user - Stringpasswd - Stringtz - int timezone| Method Detail |
|---|
public void disconnect()
public boolean connect()
public boolean isConnected()
public GMResponse request(byte type,
java.lang.String box,
java.lang.String pos)
throws java.io.IOException,
ParsePacketException
type - byte Must be one of GM_REQ_STANDARD, GM_REQ_LABEL, GM_REQ_QUERY or GM_REQ_CONVERSATIONbox - String label name or directory name or query, e.g. "Inbox"pos - String Postion of the search as String
java.io.IOException - When reading error from connection
ParsePacketException - When GMail send something we dont expect
public GMResponse request(byte type,
java.lang.String box,
java.lang.String pos,
java.lang.String[] msgs)
throws java.io.IOException,
ParsePacketException
type - bytebox - Stringpos - Stringmsgs - String[] array of msg id, if it is null no such id is sent
java.io.IOException
ParsePacketException
public java.lang.String fetchOriginalMail(java.lang.String id)
throws java.io.IOException
String - id ID of the thread
java.io.IOException
public boolean send(GMSendMailBody mailbody)
throws java.io.IOException
java.io.IOException
public GMContact[] getContact(int type,
java.lang.String search)
throws java.io.IOException,
ParsePacketException,
java.lang.IllegalArgumentException
int - type, String - search, the Search string, only usefule when searching (type=GM_CONTACT_SEARCH)
java.io.IOException - When reading error from connection
ParsePacketException - When GMail send something we dont expect
java.lang.IllegalArgumentExceptionGMConstants
public java.io.InputStream getAttachmentAsStream(java.lang.String attid,
java.lang.String msgid)
throws java.io.IOException
attid - String Attachment IDmsgid - String Message ID
java.io.IOException - Error reading from gmailpublic java.lang.String getPasswd()
public void setPasswd(java.lang.String passwd)
passwd - Stringpublic java.lang.String getTimezone()
public void setTimezone(java.lang.String timezone)
timezone - Stringpublic void setUser(java.lang.String user)
user - Stringpublic java.lang.String getUser()
public java.lang.String getProxyHost()
public int getProxyPort()
public void setProxy(java.lang.String phost,
int pport)
phost - Stringpport - intpublic org.apache.commons.httpclient.HttpClient getHttpClient()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||