Trepia is a cool idea. It's an IM client that finds other people and sorts them by their proximity to you. But while it's a great idea, the client sucks, and it's not open source, so I can't fix its annoying problems myself. So, I decided to take some time to reverse engineer the protocol in hopes that somebody will write a better Trepia client. Maybe we'll be able to run it on *nix soon!

If you discover anything else, please post the additional information in a comment.

Prologue

I coded up a simple proxy server that would
write out the packets as hex dumps, but most of that work turned out to be unnecessary, because Trepia actually
uses uncompressed, unencrypted XML to communicate with the server. So I spent a bit of time reverse engineering
the Trepia protocol.
I've only put about 2 hours into it, but I'm hoping other people will take this information and run with it.

Overview

To create a new account in Trepia, the NEWACCT packet is used. After that, when
you connect to Trepia, the client sends the CONNECT packet, to which the server
replies with the LOGIN packet. From there, it's a loop that simply processes incoming packets. I believe it doesn't need to store any state about packets seen/expected for its basic operation. The exceptions are when logging in, creating a new account, or downloading the current user's profile.

Servers

The default trepia server is located at 207.44.192.59 and runs a Trepia server on ports 8201 through 8210.
[update] The server IP seems to have changed to 66.98.134.44.

Data Types

Trepia uses the following data types:

Type

Description

Example

Integer

An unbroken block of digits

1245

String

A block of text, encoded using XML entities. Line breaks, etc are also encoded as entities. Line breaks are encoded as a single &#xa;

me &amp; joe went to the store&#xa;it wasn&apos;t fun

MAC Address

A unique identifier for a network interface

00-50-BA-75-10-F7

Hex data

An unbroken string of lowercase hex characters

ee9356e428dd9507b32715da7235

Base64 data

A solid block of data encoded as base64

/9j/4AAQSkZJRgAQSkZJRgABAB==

Location

An integer that specifies a person's location. I've noticed that people close to me have closer numbers, so the distance between people may be simple subtraction operation between their locations. However, it doesn't sound like it would work, so I'm not sure about that. UNKNOWN FORMAT

1055792857

Packet format

Each packet is an XML block. The root tag specifies the packet type. Inside the root tag are immediate children,
usually labeled 'a', 'b', 'c', 'd', etc. These children make up the parameters for the packet. So far, most children have
been in a consistent order. However, the ones dealing with profiles or user data (ie DATAREPLY)
have not always been in a consistent order. So, it's best not to rely on the order of the child nodes.

In the tables below, parameters are listed in the order the are generally sent/received by the official client.

Packet: UPDNOTE, Node: G, Parameters: 1
The UPDNOTE packet is sent when the client wants to update its location/insta-blog note.

Parameter

Type

Meaning

a

String

New note

<G><a>change my blog note</a></G>

Packet: RATEUSER, Node: U, Parameters: 2
The RATEUSER packet is sent when the client wants to rate another user.

Parameter

Type

Meaning

a

Integer

User ID

b

Integer

Rating (1 - Cool, 2 - Interesting, etc)

<U><a>12592</a><b>1</U>

Packet: NEWACCT, Node: J, Parameters: 14
The NEWACCT packet is sent to create a new Trepia account. The server will reply with a LOGIN packet.
Many of these fields may be empty, but I think none can be omitted.