Protocols/OSCAR/Foodgroups/LOCATE/Tutorials

From NINA Wiki
Revision as of 03:27, 27 March 2020 by AD (talk | contribs) (Created page with "{{Protocols/OSCAR}} == Getting a User's Buddy Info == It is a straight forward feature to implement and most users in the target audience enjoy looking at the Buddy Info of...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
OSCAR Protocol
IntroductionTermsClients
Basic
DatatypesFLAPSNACTLV
UUIDsErrorsTool IDs
Host Interaction
Rate LimitsMigrationMessages
Other Services
ADMINADVERTALERT
BARTBOSBUCPCHAT
CHAT_NAV
Tutorials
Sign OnBARTRendezvous
ICBMLocateBuddies
Foodgroups
OSERVICE (0x0001)
LOCATE (0x0002)
BUDDY (0x0003)
ICBM (0x0004)
ADVERT (0x0005)
INVITE (0x0006)
ADMIN (0x0007)
POPUP (0x0008)
PD (0x0009)
USER_LOOKUP (0x000A)
STATS (0x000B)
TRANSLATE (0x000C)
CHAT_NAV (0x000D)
CHAT (0x000E)
ODIR (0x000F)
BART (0x0010)
FEEDBAG (0x0013)
ICQ (0x0015)
BUCP (0x0017)
ALERT (0x0018)
PLUGIN (0x0022)
UNNAMED_FG_24 (0x0024)
MDIR (0x0025)
ARS (0x044A)


Getting a User's Buddy Info

It is a straight forward feature to implement and most users in the target audience enjoy looking at the Buddy Info of their friends. To implement the feature, the client needs to fetch the HTML from the backend and display it in an HTML view with javascript enabled. Even if a client does not use this to meet a license requirement, we still recommend this as a high value end user feature.

Step #1 - Fetching the content

Over the BOSS connection, send a [Protocols/OSCAR/SNAC/LOCATE_USER_INFO_QUERY2 LOCATE__USER_INFO_QUERY2] SNAC with at least the HTML_INFO type2 set.

For example, to get ChattingChuck's information the following server message would be used:

Field Size Value
u08 flapHeader.startMarker '*'
u08 flapHeader.frameType

2 ([Protocols/OSCAR/FLAP#Class:_FLAP_FRAME FLAP__FRAME_TYPE_DATA])

u16 flapHeader.sequenceNumber XX
u16 flapHeader.payloadLength YY
u16 snacHeader.foodgroup

2 ([Protocols/OSCAR/Foodgroups/LOCATE LOCATE])

u16 snacHeader.type

21 ([Protocols/OSCAR/SNAC/LOCATE_USER_INFO_QUERY2 LOCATE__USER_INFO_QUERY2])

u16 snacHeader.flags 0
u32 snacHeader.requestId ZZ
u32 type2

0x00000400 ([Protocols/OSCAR/SNAC/LOCATE_USER_INFO_QUERY2#Class:_LOCATE_QUERY_TYPE LOCATE__QUERY_TYPE_HTML_INFO])

u08 loginId.len 13
Array of u08 loginId.value 'ChattingChuck'

Step #2 - Wait for the response

Wait for a response [Protocols/OSCAR/SNAC/LOCATE_USER_INFO_REPLY LOCATE__USER_INFO_REPLY] SNAC.

For example the response for the ChattingChuck's query above might be:

Field Size Value
u08 flapHeader.startMarker '*'
u08 flapHeader.frameType

2 ([Protocols/OSCAR/FLAP#Class:_FLAP_FRAME FLAP__FRAME_TYPE_DATA])

u16 flapHeader.sequenceNumber XX
u16 flapHeader.payloadLength YY
u16 snacHeader.foodgroup

2 ([Protocols/OSCAR/Foodgroups/LOCATE LOCATE])

u16 snacHeader.type

6 ([Protocols/OSCAR/SNAC/LOCATE_USER_INFO_REPLY LOCATE__USER_INFO_REPLY])

u16 snacHeader.flags 0
u32 snacHeader.requestId ZZ
u08 info.displayId.len 13
Array of u08 info.displayId.value 'ChattingChuck'
u16 info.evil 0
u16 info.attrs.num 1
u16 info.attrs[0].tag

1 ([Protocols/OSCAR/Foodgroups/OSERVICE/Datatypes/USERINFO#TLV_Class:_OSERVICE_USER_INFO_TAGS OSERVICE__USER_INFO_TAGS_NICK_FLAGS])

u16 info.attrs[0].len 2
u16 info.attrs[0].value 0
u16 locateInfo[0].tag

13 ([Protocols/OSCAR/Foodgroups/LOCATE#TLV_Class:_LOCATE_TAGS LOCATE__TAGS_HTML_INFO_TYPE])

u16 locateInfo[0].len 9
Array of u08 locateInfo[0].value 'text/html'
u16 locateInfo[1].tag

14 ([Protocols/OSCAR/Foodgroups/LOCATE#TLV_Class:_LOCATE_TAGS LOCATE__TAGS_HTML_INFO_DATA])

u16 locateInfo[1].len 100
Array of u16 locateInfo[1].value '<html>Stuff</html>'

Step #3 - Display the content

The client should now open (or reuse) an HTML view with javascript enabled and display the content returned inside the LOCATE__TAGS_HTML_INFO_DATA TLV.