|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--wtanaka.praya.Protocol
|
+--wtanaka.praya.yahoo.YahooClient
Yahoo Pager Client Library adapted from gtkyahoo
Yahoo Pager Client Library This code is based on code by Douglas Winslow. The original info from his code is listed below. This code has taken his code and has been altered to my naming and coding conventions and has been made more usable as a library of routines. -- Nathan Neulinger
Yahoo Pager Client Emulator Pro - yppro.c A basic reference implementation Douglas WinslowConfiguration items include:Tue Sep 1 02:28:21 EDT 1998 Version 2, Revision 2 Known to compile on Linux 2.0, FreeBSD 2.2, and BSDi 3.0. hi to aap bdc drw jfn jrc mm mcd [cejn]b #cz and rootshell Finally! Yahoo finally patched their server-side, and things will be getting back to "normal". I will continue to maintain this code as long as there is interest for it. Since Yahoo will be discontinuing YPNS1.1 login support shortly, I've upgraded this client to do YPNS1.2. You *must* have a password to pass authentication to the pager server. This authentication is done by a weird HTTP cookie method. This code is distributed under the GNU General Public License (GPL)
Protocol proto = new YahooClient();
// Add a listener to receive incoming messages.
proto.addListener(new Pushable()
{
public void receiveMessage (Message m)
{
if (m instanceof MailMessage)
{
MailMessage newmail = (MailMessage) m;
System.out.println (newmail.getUser()
+ " has "
+ newmail.getNumMessages()
+ " new messages.");
}
}
});
Return to
or the Praya Homepage
| Field Summary | |
static int |
CONF_ID
|
static int |
CONF_ITEM_COUNT
|
static int |
CONF_PASSWD
|
static int |
CONF_STATUS
|
(package private) static java.lang.String |
current_config
|
private ConfigItem[] |
m_configItems
|
private GTKYEvents |
m_events
|
private boolean |
m_firstConnect
|
private GTKYStatus |
m_status
|
private YahooReadThread |
m_thread
|
private YahooContext |
m_yahooContext
|
static int |
SO_TIMEOUT
|
static java.lang.String[] |
statusList
List of visible strings, in any order, corresponding to the status configuration pulldown menu. |
| Fields inherited from class wtanaka.praya.Protocol |
descriptionListeners, iAmGarbage, m_buddyList, m_configPanel, m_currentDescription, m_messageListeners, recipientListeners |
| Constructor Summary | |
YahooClient()
Constructor |
|
| Method Summary | |
private void |
append_notify_msg(java.lang.String msg)
Conditionally inform everybody that wants to know about the notify message |
(package private) java.lang.String |
byteArrayToString(byte[] array)
|
void |
checkForNewMessages(boolean isAutomatic)
Checks for new messages on the protocol. |
void |
connect()
Connects to the network, if that makes any sense. |
CommandInterface[] |
consoleCommands()
Returns a list of commands available through this console. |
void |
disconnect()
Disconnects from the network, if that makes any sense. |
java.lang.String |
getBuddyGroup(java.lang.String buddyID)
Given a Yahoo ID, return its corresponding group name if it is a buddy of the currently logged in user. |
ConfigItem[] |
getConfiguration()
|
Recipient |
getDefaultRecipient()
|
static java.awt.Image |
getIcon()
|
static java.lang.String |
getProtocolDescription()
Used to describe the class of this protocol, before any instances have been created. |
YahooContext |
getYahooContext()
Gets the context for this instance of YahooClient. |
(package private) void |
gtkyahoo_userlist_refresh()
|
(package private) void |
gtkyahoo_userlist_update(java.lang.String user_to_update)
|
boolean |
isConnected()
Returns if the protocol is connected right now. |
void |
process_calendar_message(YahooPacket pkt)
|
(package private) void |
process_packet_chatinvite(YahooPacket pkt)
|
(package private) void |
process_packet_conference(YahooPacket pkt)
|
(package private) void |
process_packet_filetransfer(YahooPacket pkt)
|
void |
process_packet_message(YahooPacket pkt)
|
void |
process_packet_newmail(YahooPacket pkt)
|
(package private) void |
process_packet_ping(YahooPacket pkt)
|
(package private) void |
process_packet_status(YahooPacket pkt)
|
private void |
retryInit()
|
private void |
set_status_line(YahooIDStatus rec)
|
void |
setStatus(int status)
|
void |
setStatus(Status status)
Sets the status. |
private static Status |
statusFromYahooIDStatus(YahooIDStatus rec,
int packetService)
|
private static char |
y_pp_st_get(java.lang.String content,
int itmpc)
|
private void |
yahoo_cmd_activate_id(YahooContext ctx,
java.lang.String newid)
|
private void |
yahoo_cmd_logoff(YahooContext ctx)
|
private void |
yahoo_cmd_logon(YahooContext ctx,
int initial_status)
Log in, optionally activating other secondary identities |
(package private) void |
yahoo_cmd_msg(YahooContext ctx,
java.lang.String active_user,
java.lang.String toUser,
java.lang.String msg)
|
private void |
yahoo_cmd_user_status(YahooContext ctx)
|
(package private) static void |
yahoo_free_buddies(YahooContext ctx)
Free a buddy list |
(package private) static void |
yahoo_free_identities(YahooContext ctx)
|
(package private) int |
yahoo_getdata(YahooContext ctx)
|
private void |
yahoo_parsepacket_calendar(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
|
private void |
yahoo_parsepacket_chatinvite(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
|
private void |
yahoo_parsepacket_conference_invite(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
Packet format: id^host^invited-users^msg^0or1 |
private void |
yahoo_parsepacket_conference_msg(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
|
private void |
yahoo_parsepacket_conference_user(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
|
private void |
yahoo_parsepacket_filetransfer(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
|
private void |
yahoo_parsepacket_grouprename(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
|
private void |
yahoo_parsepacket_newcontact(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
|
private int |
yahoo_parsepacket_newmail(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
|
(package private) int |
yahoo_parsepacket_ping(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
|
(package private) YahooPacket |
yahoo_parsepacket(YahooContext ctx,
YahooRawPacket inpkt)
|
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final int SO_TIMEOUT
public static final int CONF_ID
public static final int CONF_PASSWD
public static final int CONF_STATUS
public static final int CONF_ITEM_COUNT
private ConfigItem[] m_configItems
private boolean m_firstConnect
public static final java.lang.String[] statusList
private YahooContext m_yahooContext
private YahooReadThread m_thread
private GTKYStatus m_status
private GTKYEvents m_events
static java.lang.String current_config
| Constructor Detail |
public YahooClient()
| Method Detail |
public static java.awt.Image getIcon()
public static java.lang.String getProtocolDescription()
public ConfigItem[] getConfiguration()
getConfiguration in class Protocolwtanaka.praya.Protocolpublic Recipient getDefaultRecipient()
getDefaultRecipient in class Protocol
private void retryInit()
throws java.net.UnknownHostException,
java.io.IOException,
AuthException
public void connect()
throws java.io.IOException
Protocolconnect in class Protocolwtanaka.praya.Protocoljava.io.IOException - if the connection fails due to an I/O error.java.lang.InterruptedException - todo, why does it throw this?public void disconnect()
Protocoldisconnect in class Protocol
public void setStatus(Status status)
throws java.io.IOException
setStatus in class Protocolpublic boolean isConnected()
ProtocolisConnected in class Protocoljava.lang.String byteArrayToString(byte[] array)
public void setStatus(int status)
throws java.io.IOException
public void checkForNewMessages(boolean isAutomatic)
ProtocolcheckForNewMessages in class Protocolwtanaka.praya.ProtocolisAutomatic - true if the check is generated automatically with a
timer. false if the check is generated manually by the user.public java.lang.String getBuddyGroup(java.lang.String buddyID)
buddyID - a non-null yahoo id whose group name to return.public CommandInterface[] consoleCommands()
ProtocolconsoleCommands in class Protocol
private void yahoo_cmd_logon(YahooContext ctx,
int initial_status)
throws AuthException,
java.io.IOException
AuthException - if we hae the wrong username or
password.java.io.IOException - if a network error is encountered.
void yahoo_cmd_msg(YahooContext ctx,
java.lang.String active_user,
java.lang.String toUser,
java.lang.String msg)
throws java.io.IOException
private void yahoo_cmd_activate_id(YahooContext ctx,
java.lang.String newid)
throws java.io.IOException
private void yahoo_cmd_user_status(YahooContext ctx)
throws java.io.IOException
private void yahoo_cmd_logoff(YahooContext ctx)
throws java.io.IOException
YahooPacket yahoo_parsepacket(YahooContext ctx,
YahooRawPacket inpkt)
int yahoo_parsepacket_ping(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
private void yahoo_parsepacket_conference_invite(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
conf_id - The conference id -- usually of the form name-number,
though it doesn't seem to matter much. ex: jaylubo-123conf_host - The person inviting you to conference.userlist - Everyone else invited to conference.
Null terminated array of strings.msg - Invitation message.conf_type - Type of conference ( 0 = text, 1 = voice )
private void yahoo_parsepacket_conference_msg(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
private void yahoo_parsepacket_conference_user(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
private void yahoo_parsepacket_filetransfer(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
private void yahoo_parsepacket_calendar(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
private void yahoo_parsepacket_chatinvite(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
private void yahoo_parsepacket_newcontact(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
private int yahoo_parsepacket_newmail(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
private void yahoo_parsepacket_grouprename(YahooContext ctx,
YahooPacket pkt,
YahooRawPacket inpkt)
int yahoo_getdata(YahooContext ctx)
throws java.io.IOException
private static final char y_pp_st_get(java.lang.String content,
int itmpc)
private void append_notify_msg(java.lang.String msg)
public void process_calendar_message(YahooPacket pkt)
public void process_packet_message(YahooPacket pkt)
void process_packet_ping(YahooPacket pkt)
void process_packet_filetransfer(YahooPacket pkt)
void process_packet_conference(YahooPacket pkt)
private void set_status_line(YahooIDStatus rec)
private static Status statusFromYahooIDStatus(YahooIDStatus rec,
int packetService)
void process_packet_status(YahooPacket pkt)
public void process_packet_newmail(YahooPacket pkt)
void process_packet_chatinvite(YahooPacket pkt)
static void yahoo_free_buddies(YahooContext ctx)
static void yahoo_free_identities(YahooContext ctx)
public YahooContext getYahooContext()
void gtkyahoo_userlist_refresh()
void gtkyahoo_userlist_update(java.lang.String user_to_update)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||