jcx.util
Class icq
java.lang.Object
|
+--jcx.util.icq
- All Implemented Interfaces:
- java.lang.Runnable
- public class icq
- extends java.lang.Object
- implements java.lang.Runnable
此類別 icq
為一 ICQ API,
凡是欲連結 ICQ 皆可引用此 API 。
使用方法:
1.安裝ICQ ,申請一個 ICQ 的帳號(UIN) 並記好 password
2.如果欲送訊息給對方,先確定已加入 Contact List
3.將安裝好的 ICQ OFF-Line
P.S. 使用完後,建議要呼叫 close()
Constructor Summary |
icq(java.lang.String uin,
java.lang.String pwd)
new a icq object with initial UIN and PASSWORD
must use open to start connection after this |
icq(java.lang.String uin,
java.lang.String pwd,
java.lang.String server,
int port)
new a icq object with initial ID and PASSWORD and Server and Port.
must use open to start connection after this |
Method Summary |
void |
close()
Close icq session |
boolean |
isAlive()
test ICQ is alive |
static void |
main(java.lang.String[] args)
|
boolean |
open()
open conection to icq server. |
void |
run()
|
boolean |
send(java.lang.String uin,
java.lang.String msg)
send message to icq-friend(UIN). must open() first.
friend must on-line |
static void |
sendICQ(java.lang.String UIN,
java.lang.String MSG)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
icq
public icq(java.lang.String uin,
java.lang.String pwd)
- new a icq object with initial UIN and PASSWORD
must use
open
to start connection after this
- Parameters:
uin
- icq
icq UIN.pwd
- icq
login PASSWORD.
icq
public icq(java.lang.String uin,
java.lang.String pwd,
java.lang.String server,
int port)
- new a icq object with initial ID and PASSWORD and Server and Port.
must use
open
to start connection after this
- Parameters:
uin
- icq
icq UIN.pwd
- icq
login PASSWORD.server
- icq
Server host. default icq.mirabilis.comport
- icq
Server port. default 4000
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
open
public boolean open()
throws java.io.IOException
- open conection to icq server.
- Parameters:
none.
- - Returns:
- true: open sucess. false: login fail
- Throws:
java.io.IOException
- if login error
isAlive
public boolean isAlive()
throws java.io.IOException
- test ICQ is alive
- Parameters:
none.
- - Returns:
- true: send sucess. false: send fail (friend may off-line)
- Throws:
java.io.IOException
- if send error
send
public boolean send(java.lang.String uin,
java.lang.String msg)
throws java.io.IOException
- send message to icq-friend(UIN). must open() first.
friend must on-line
- Parameters:
uin:
- friend UIN.msg:
- message to send (Unicode).- Returns:
- true: send sucess. false: send fail (friend may off-line)
- Throws:
java.io.IOException
- if send error
close
public void close()
throws java.io.IOException
- Close icq session
- Returns:
- none.
sendICQ
public static void sendICQ(java.lang.String UIN,
java.lang.String MSG)
throws java.lang.Exception
main
public static void main(java.lang.String[] args)
throws java.lang.Exception