|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.walluck.oscar.handlers.SNACHandler
org.walluck.oscar.handlers.SSIHandler
Family 0x0013 - Server-Side/Stored Information.
Relatively new facility that allows storing of certain types of information, such as a users buddy list, permit/deny list, and permit/deny preferences, to be stored on the server, so that they can be accessed from any client.
We keep 2 copies of SSI data:
All of the itemList
functions near the top just modify the
list that is given to them (e.g. they don't send SNAC's).
The SNAC sending and receiving functions are lower down in the file, and they're simpler. They are in the order of the subtypes they deal with, starting with the request rights function (subtype 0x0002), then parse rights (subtype 0x0003), then -- well, you get the idea.
types:
0x0000 - buddy entryTLV's (with associated types):
TLV(0x0066) - awaiting authorization (0x0000)
SNACHandler
Constructor Summary | |
SSIHandler()
Family 0x0013. |
Method Summary | |
void |
addBuddy(AIMSession sess,
java.lang.String name,
java.lang.String group,
java.lang.String alias,
java.lang.String comment,
java.lang.String smsnum,
boolean needauth)
Add a buddy to the list. |
void |
addDeny(AIMSession sess,
java.lang.String name)
Add a deny buddy to the list. |
void |
addModDel(AIMSession sess)
Subtype 0x0008/0x0009/0x000a - SSI Add/Mod/Del Item(s). |
void |
addPermit(AIMSession sess,
java.lang.String name)
Add a permit buddy to the list. |
void |
aliasBuddy(AIMSession sess,
java.lang.String gn,
java.lang.String sn,
java.lang.String alias)
Change the alias stored on the server for a given buddy. |
void |
cleanList(AIMSession sess)
This "cleans" the SSI list. |
void |
debugPrintLists(AIMSession sess)
Debug method to print the official and local lists. |
void |
delBuddy(AIMSession sess,
java.lang.String name,
java.lang.String group)
Deletes a buddy from the list. |
void |
delDeny(AIMSession sess,
java.lang.String name)
Deletes a deny buddy from the list. |
void |
deleteList(AIMSession sess)
Delete all SSI data. |
void |
delPermit(AIMSession sess,
java.lang.String name)
Deletes a permit buddy from the list. |
void |
enable(AIMSession sess)
Subtype 0x0007 - SSI Activate Data. |
void |
freeList(AIMSession sess)
Free all SSI data. |
java.lang.String |
getAlias(java.util.List list,
java.lang.String gn,
java.lang.String sn)
Locally find the alias of the given buddy. |
java.lang.String |
getBuddyComment(java.util.List list,
java.lang.String gn,
java.lang.String sn)
Locally find the buddy comment of the given buddy. |
byte |
getPermdeny(java.util.List list)
Locally find the permit/deny setting item, and return the setting. |
int |
getPresence(java.util.List list)
Locally find the presence flag item, and return the setting. |
void |
handleSNAC(AIMSession sess,
SNACHandler handler,
AIMFrame frame,
SNAC snac,
AIMInputStream buffer)
Handles incoming SNAC's. |
SSIItem |
itemListAdd(java.util.List list,
java.lang.String name,
int gid,
int bid,
int type,
TLVChain data)
Locally add a new item to the given item list. |
int |
itemListCmp(SSIItem cur1,
SSIItem cur2)
Compare two items to see if they have the same data. |
int |
itemListDel(java.util.List list,
SSIItem del)
Locally delete an item from the given item list. |
SSIItem |
itemListExists(java.util.List list,
java.lang.String sn)
Check if the given buddy exists in any group in the buddy list. |
SSIItem |
itemListFind(java.util.List list,
int gid,
int bid)
Locally find an item given a group ID and a buddy ID. |
SSIItem |
itemListFindItem(java.util.List list,
java.lang.String gn,
java.lang.String sn,
int type)
Locally find an item given a group name, screen name, and type. |
java.lang.String |
itemListFindParentName(java.util.List list,
java.lang.String sn)
Locally find the parent item of the given buddy name. |
boolean |
itemListValid(java.util.List list,
SSIItem item)
Tests whether the item is actually present in the SSI list. |
void |
modBegin(AIMSession sess)
Subtype 0x0011 - SSI Begin Data Modification. |
void |
modEnd(AIMSession sess)
Subtype 0x0012 - SSI End Data Modification. |
void |
moveBuddy(AIMSession sess,
java.lang.String oldgn,
java.lang.String newgn,
java.lang.String sn)
Move a buddy from one group to another group. |
void |
renameGroup(AIMSession sess,
java.lang.String oldgn,
java.lang.String newgn)
Rename a group. |
void |
reqData(AIMSession sess)
Subtype 0x0004 - Request SSI Data when you don't have a timestamp and revision number. |
void |
reqIfChanged(AIMSession sess,
long timestamp,
short numitems)
Subtype 0x0005 - Request SSI Data when you have a timestamp and revision number. |
void |
reqRights(AIMSession sess)
Subtype 0x0002 - Request SSI Rights. |
void |
sendAuth(AIMSession sess,
java.lang.String sn,
java.lang.String msg)
Subtype 0x0014 - Grant authorization Authorizes a contact so they can add you to their contact list. |
void |
sendAuthReply(AIMSession sess,
java.lang.String sn,
byte reply,
java.lang.String msg)
Subtype 0x001a - Send authorization reply Sends a reply to a request for authorization. |
void |
sendAuthRequest(AIMSession sess,
java.lang.String sn,
java.lang.String msg)
Subtype 0x0018 - Send authorization request Sends a request for authorization to the given contact. |
void |
setIcon(AIMSession sess,
byte[] iconsum)
Set buddy icon information |
void |
setPermDeny(AIMSession sess,
byte permdeny,
int vismask)
Store your permit/deny setting on the server, and start using it. |
void |
setPresence(AIMSession sess,
int presence)
Stores your setting for whether you should show up as idle or not. |
void |
sync(AIMSession sess)
If there are changes, then create temporary items and call addModDel . |
boolean |
waitingForAuth(java.util.List list,
java.lang.String gn,
java.lang.String sn)
Locally find if you are waiting for authorization for a buddy. |
Methods inherited from class org.walluck.oscar.handlers.SNACHandler |
getFamily, getVersion, setFamily, setVersion |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SSIHandler()
Method Detail |
public void debugPrintLists(AIMSession sess)
sess
- the oscar sessionpublic SSIItem itemListAdd(java.util.List list, java.lang.String name, int gid, int bid, int type, TLVChain data)
list
- the current list of itemsname
- string of the name of the new item, or null if the
item should have no namegid
- The group ID# you want the new item to have, or -1 if we
should pick somethingbid
- The buddy ID# you want the new item to have, or -1 if we
should pick somethingtype
- The type of the item, 0x0000 for a contact, 0x0001 for a
group, etc.data
- The additional data for the new item
public int itemListDel(java.util.List list, SSIItem del)
list
- the current list of itemsdel
- the item you want to remove from the list
public int itemListCmp(SSIItem cur1, SSIItem cur2) throws java.io.IOException
cur1
- the first itemcur2
- the second item
java.io.IOException
- if an error occurspublic boolean itemListValid(java.util.List list, SSIItem item)
list
- the listitem
- the item
public SSIItem itemListFind(java.util.List list, int gid, int bid)
list
- the current list of itemsgid
- the group ID of the desired itembid
- the buddy ID of the desired item
public SSIItem itemListFindItem(java.util.List list, java.lang.String gn, java.lang.String sn, int type)
list
- the current list of itemsgn
- the group name of the desired itemsn
- the buddy name of the desired itemtype
- the type of the desired item
public SSIItem itemListExists(java.util.List list, java.lang.String sn)
list
- the current list of itemssn
- the group name of the desired item
public java.lang.String itemListFindParentName(java.util.List list, java.lang.String sn)
list
- the current list of itemssn
- the buddy name of the desired item
public byte getPermdeny(java.util.List list) throws java.io.IOException
list
- the current list of items
java.io.IOException
- if an error occurspublic int getPresence(java.util.List list) throws java.io.IOException
AIM_FLAG
constants in
AIMConstants
.
list
- the current list of items
java.io.IOException
- if an error occursAIMConstants
public java.lang.String getAlias(java.util.List list, java.lang.String gn, java.lang.String sn) throws java.io.IOException
list
- the current list of itemsgn
- the group of the buddy.sn
- the name of the buddy.
java.io.IOException
- if an error occurspublic java.lang.String getBuddyComment(java.util.List list, java.lang.String gn, java.lang.String sn) throws java.io.IOException
list
- the current list of itemsgn
- the group of the buddy.sn
- the name of the buddy.
java.io.IOException
- if an error occurspublic boolean waitingForAuth(java.util.List list, java.lang.String gn, java.lang.String sn) throws java.io.IOException
list
- the current list of itemsgn
- the group of the buddysn
- the name of the buddy
java.io.IOException
- if an error occurspublic void sync(AIMSession sess) throws java.io.IOException
addModDel
.
sess
- the oscar session
java.io.IOException
- if an error occurspublic void freeList(AIMSession sess)
sess
- the oscar sessionpublic void deleteList(AIMSession sess) throws java.io.IOException
sess
- the oscar session
java.io.IOException
- if an error occurspublic void cleanList(AIMSession sess) throws java.io.IOException
sess
- the oscar session
java.io.IOException
- if an error occurspublic void addBuddy(AIMSession sess, java.lang.String name, java.lang.String group, java.lang.String alias, java.lang.String comment, java.lang.String smsnum, boolean needauth) throws java.io.IOException
sess
- the oscar sessionname
- the name of the itemgroup
- the group of the itemalias
- the alias/nickname of the item, or nullcomment
- the buddy comment for the item, or nullsmsnum
- the locally assigned SMS number, or nullneedauth
- a boolean
value
java.io.IOException
- if an error occurspublic void addPermit(AIMSession sess, java.lang.String name) throws java.io.IOException
sess
- the oscar sessionname
- the name of the item
java.io.IOException
- if an error occurspublic void addDeny(AIMSession sess, java.lang.String name) throws java.io.IOException
sess
- the oscar sessionname
- the name of the item
java.io.IOException
- if an error occurspublic void delBuddy(AIMSession sess, java.lang.String name, java.lang.String group) throws java.io.IOException
sess
- the oscar sessionname
- the name of the item, or nullgroup
- the group of the item, or null
java.io.IOException
- if an error occurspublic void delPermit(AIMSession sess, java.lang.String name) throws java.io.IOException
sess
- the oscar sessionname
- the name of the item, or null
java.io.IOException
- if an error occurspublic void delDeny(AIMSession sess, java.lang.String name) throws java.io.IOException
sess
- the oscar sessionname
- the name of the item, or null
java.io.IOException
- if an error occurspublic void moveBuddy(AIMSession sess, java.lang.String oldgn, java.lang.String newgn, java.lang.String sn) throws java.io.IOException
sess
- the oscar sessionoldgn
- the group that the buddy is currently innewgn
- the group that the buddy should be moved in tosn
- the name of the buddy to be moved
java.io.IOException
- if an error occurspublic void aliasBuddy(AIMSession sess, java.lang.String gn, java.lang.String sn, java.lang.String alias) throws java.io.IOException
sess
- the oscar sessiongn
- the group that the buddy is currently insn
- the screen name of the buddyalias
- the new alias for the buddy
java.io.IOException
- if an error occurspublic void renameGroup(AIMSession sess, java.lang.String oldgn, java.lang.String newgn) throws java.io.IOException
sess
- the oscar sessionoldgn
- the old group namenewgn
- the new group name
java.io.IOException
- if an error occurspublic void setPermDeny(AIMSession sess, byte permdeny, int vismask) throws java.io.IOException
sess
- The oscar session.permdeny
- Your permit/deny setting. Can be one of the following:
vismask
- A bitmask of the class of users to whom you want to be
visible. See the AIM_FLAG_BLEH in AIMConstants
java.io.IOException
- if an error occurspublic void setIcon(AIMSession sess, byte[] iconsum) throws java.io.IOException
sess
- the oscar sessioniconsum
- a byte[]
value
java.io.IOException
- if an error occurspublic void setPresence(AIMSession sess, int presence) throws java.io.IOException
sess
- The oscar session.presence
- I think it's a bitmask, but I only know what one of the
bits is:java.io.IOException
- if an error occurspublic void reqRights(AIMSession sess) throws java.io.IOException
sess
- an AIMSession
value
java.io.IOException
- if an error occurspublic void reqData(AIMSession sess) throws java.io.IOException
sess
- the oscar session
java.io.IOException
- if an error occurspublic void reqIfChanged(AIMSession sess, long timestamp, short numitems) throws java.io.IOException
sess
- the oscar sessiontimestamp
- the timestampnumitems
- the numitems array
java.io.IOException
- if an error occurspublic void enable(AIMSession sess) throws java.io.IOException
sess
- an AIMSession
value
java.io.IOException
- if an error occurspublic void addModDel(AIMSession sess) throws java.io.IOException
sess
- an AIMSession
value
java.io.IOException
- if an error occurspublic void modBegin(AIMSession sess) throws java.io.IOException
sess
- the oscar session
java.io.IOException
- if an error occurspublic void modEnd(AIMSession sess) throws java.io.IOException
sess
- the oscar session
java.io.IOException
- if an error occurspublic void sendAuth(AIMSession sess, java.lang.String sn, java.lang.String msg) throws java.io.IOException
sess
- the oscar sessionsn
- the screennamemsg
- the message
java.io.IOException
- if an error occurspublic void sendAuthRequest(AIMSession sess, java.lang.String sn, java.lang.String msg) throws java.io.IOException
sess
- the oscar sessionsn
- the screennamemsg
- the message
java.io.IOException
- if an error occurspublic void sendAuthReply(AIMSession sess, java.lang.String sn, byte reply, java.lang.String msg) throws java.io.IOException
sess
- the oscar sessionsn
- the screennamereply
- the replymsg
- the message
java.io.IOException
- if an error occurspublic void handleSNAC(AIMSession sess, SNACHandler handler, AIMFrame frame, SNAC snac, AIMInputStream buffer) throws java.io.IOException
handleSNAC
in class SNACHandler
sess
- the oscar sessionhandler
- the handlerframe
- the incoming framesnac
- the incoming SNACbuffer
- the incoming buffer
java.io.IOException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |