Node:What do I have unread, Up:Common Commands



What do I have unread

Each person has a membership list containing the conferences the person is a member of. Each element is an object of type Membership. Among other things it contains the number of the conference, the priority of the membership, when the person most recently marked a text as read in the conference, and which texts the person has read.

The list of read texts consists of two parts: a local text number called last-text-read and a list of local text numbers called read-texts. The person has marked all texts up to and including last-text-read as read, and also the texts listed in read-texts. All other texts in the conference are unread. Clients can use either the query-read-texts or get-membership calls to get membership data.

The standard procedure for finding out which texts are unread is the following:

  1. Call get-unread-confs for the person. This returns a list of conferences in which the person may have unread texts. This call may return conferences that do not contain any unread texts, but it will never forget to return a conference that does contain an unread text.
  2. Call query-read-texts for each conference returned in the previous step. This will return the membership data for all the conferences that may contain unread texts.
  3. Call get-uconf-stat for each conference returned in the first step. The conference status will be needed shortly. Repeat the following steps for each conference.
  4. Compare the highest existing local number in the conference (from the conference status) with the last-text-read field for the corresponding membership. If the highest existing local text is higher than last-text-read, the conference may contain unread texts.
  5. Get part of the local to global map from the conference starting at last-text-read and ending at the highest existing local number. Every local number in the map that is not read according to the membership data and that has a mapping to a global number is an unread text. You might say that you remove the read texts from the map to get the unread texts.

Take care not to call get-map or get-membership too much since they tend to be expensive operations. Use get-unread-confs and query-read-texts to minimize the work. Another point to remember is that the server will send asynchronous messages with information about new texts. Clients need to listen to these messages.