kom.gateway
Class Build

java.lang.Object
  |
  +--kom.gateway.DBLow
        |
        +--kom.gateway.DBHigh
              |
              +--kom.gateway.KOMutil
                    |
                    +--kom.gateway.Form
                          |
                          +--kom.gateway.Chat
                                |
                                +--kom.gateway.Grade
                                      |
                                      +--kom.gateway.News
                                            |
                                            +--kom.gateway.Build
Direct Known Subclasses:
SendMail

public class Build
extends News

Displays a KOM object, handles the details of the GET operation


Inner Class Summary
 class Build.KOMactivity
          Class representing an activity (forum, user, chat etc)
 class Build.KOMcategory
          Category object
 class Build.KOMhome
          Top (home) object class
 class Build.KOMmsg
          Class representing an individual KOM message
 class Build.KOMmt
          Class common to threads and messages
 class Build.KOMquery
          KOMquery allows the users of KOM2000 to specify an evaluation type query without having to specify the raw HTML text.
 class Build.KOMsub
          Common class for categories, activities, threads, etc
 class Build.KOMthr
          Class representing a KOM message thread.
 class Build.KOMuser
          User class
 
Inner classes inherited from class kom.gateway.KOMutil
KOMutil.LookupTables, KOMutil.UFtable
 
Field Summary
(package private)  Build.KOMactivity curract
          Current activity
(package private) static int kBalt
           
(package private) static int kBalt2
           
(package private) static int kBintro
           
(package private) static int kBintro2
           
(package private) static int kBrespondents
           
(package private) static int kBscale
           
(package private) static int kBscale2
           
(package private) static int kCnameq
           
(package private) static int kCnameq2
           
(package private) static int kCnewlocname
           
(package private) static int kCnewmembermail
           
(package private) static int khead
           
(package private) static int kPlogin
           
(package private) static int kPloginpw
           
(package private) static int kPnewloccat
           
(package private) static int kPnewlocshort
           
(package private) static int kPopenness
           
(package private) static int kPsecret
           
(package private) static int kPsecret2
           
(package private) static int kstephead
           
(package private) static int ksteptail
           
(package private) static int ktail
           
(package private) static boolean modified
           
(package private) static QueryElement[] qrytable
          List describing html structure of query-wizard.
(package private)  SendMail SM
          Iff this object is a SendMail object, SM will be set to this"
 
Fields inherited from class kom.gateway.News
format, HTML, limit, NEWSLIMIT, PLAIN, REGULAR, userObject
 
Fields inherited from class kom.gateway.Chat
oldbody, oldpres, reverseChat
 
Fields inherited from class kom.gateway.Form
acceptform, added, bodytext, curform, formcodes, isHTML, isVote, kBase, kBbody, kCname, kCuser, kDColor, kFBase, KFC, kHColor, kIcons, kKFC, kLColor, kPboard, kPcomm, kPdate, kPhtml, kPhtmldef, kPinterval, kPnotif, kPshort, kPtype, kServer, kTarea, oldOutput, outputText, submitted, substkey
 
Fields inherited from class kom.gateway.KOMutil
ACT, anyAccess, arglist, argsep, argtab, attachments, BOK, BOUNDARYSTART, CAT, CHA, cidTable, CLO, config, curNgd, DIC, environment, gateway, gavePassword, GEN, GRA, GRP, inlineCurr, inlines, INT, LINE_CUTOFF, LINE_FUDGE, LIS, lt, MAILIT, messageRecipientTypeCode, MIM, MOD, N_RECTY, N_RECTYPECODE, newsclient, newsClients, newsData, nntpAuth, NWS, NWSART, objCache, oCurr, oldnews, POSTIT, RAT, REC_BCC, REC_CC, REC_TO, recTypeCode, REP, response, rLoc, savednews, sCursor, servletBase, session, THR, userData, USR, VOT
 
Fields inherited from class kom.gateway.DBHigh
AdminURL, cache, HomeURL, UsersURL
 
Fields inherited from class kom.gateway.DBLow
absCDBpath, config, fSep, fSeparator, msgAuth, msgParts
 
Constructor Summary
Build(ServerConfig config, HTTPResponse response, Gateway gateway)
          Constructor
 
Method Summary
(package private)  void addParts(java.lang.String id, javax.mail.internet.MimeMultipart mp, Upload[] parts, java.lang.String disp)
          Adds parts from an Upload array
(package private)  void addrecs(KomData ht, java.lang.String cre)
          Shows the proposed recipients of a message to be created
 java.io.InputStream build(java.lang.String uri, java.lang.String argl, char argdelim)
          Constructs the response data for an action.
(package private)  java.util.Vector buildReferences(java.lang.String[] prec, java.lang.String[] pnum, java.util.Hashtable beenThere)
          Makes a vector of ids of messages referred to (recursively).
 boolean checkCDB()
          Checks if CDB is set up, creates a part at a time if not.
 java.io.InputStream contentHeaders(java.lang.String url, java.io.InputStream ins)
          Defines content headers
(package private)  void copyParts(javax.mail.internet.MimeMultipart from, javax.mail.internet.MimeMultipart to, javax.mail.internet.MimeBodyPart p0, java.lang.String text)
          Copies body parts from a multipart to another multipart, excluding parts whose Content-Id is not referred from the text.
(package private)  void delete(KomData ht)
          Shows result of delete operation, and records the operation.
(package private)  void dispdelete(KomData ht)
          Displays special forms if "delete=yes" or "delete=question" or "delete=expunge" are part of the invoking url, otherwise shows a "normal" form
(package private)  void dispexcl(KomData ht)
          Displays an index page showing members in an activity
(package private)  void disphelp()
          Displays a help page (in English or Swedish depending on the dialogue language parameter in userData).
(package private)  void dispinfo(java.lang.String codes, boolean isorg)
          Displays an index page showing users and forums
(package private)  void displogin(KomData ht)
          Displays a login page
(package private)  void dispmain()
          Displays top (main) menu bar.
 void dispnormal(KomData ht)
          Creates the "normal" part of the page for an object
private  void dispparent(KomData ht, java.lang.String par)
          Shows data for a parent
(package private)  void disppreview(KomData obj)
          Shows the header part of a message/presentation text preview
 void disprecs(KomData ht)
          Displays recipients
(package private)  void dispreg()
          Displays page for registration
 boolean doLogin(java.lang.String userref, java.lang.String password)
          Establishes a new current user.
(package private)  void expunge(KomData ht)
          Shows result of expunge operation, and records the operation.
(package private)  KomData getAct(java.lang.String id)
          Gets activity object from an object reference.
(package private)  void getHier(KomData ht)
          Sets up userData to reflect current object hierarchy.
 Build.KOMmsg getKOMmsg()
          Creates an empty KOMmsg object
 Build.KOMmsg getKOMmsg(java.util.Vector v, int i)
          Creates a KOMmsg object from a vector element
 java.lang.String getMessageId(java.lang.String id)
          Gets a message id from a thread part reference
(package private)  java.lang.String getMimeRef(KomData msg)
           
 KomData getMt(java.lang.String id)
          Gets message or thread
 NewsClient getNewsClient(Build.KOMactivity act, java.lang.StringBuffer em)
          Establishes a NewsClient for a (newsgroup) activity.
(package private)  NewsGroupData getNewsGroupData(java.lang.String id)
          Defines current newsgroup (curNgd = NewsGroupData instance)
 KomData getObj(java.lang.String ref)
          Gets an object (a subtype of KomData)
 KomData getRecop(KomData rt)
          Makes a recipient operation
(package private)  int[] getThreads(java.lang.String[] opers)
          Makes an array of indices, each referring to the last element of a thread.
private  void getUserNews(java.lang.String userref, Build.KOMuser userobj)
          Gets user news and stores it in newsData.
(package private)  void handleOverviews(Overview[] ot, java.lang.String name, java.lang.String actr, Build.KOMactivity act)
          Stores an array of Overview records as thread elements
private  void history(KomData obj)
          Shows the "history" of an activity
 void logout()
          Logs out the current user
private  javax.mail.internet.MimeBodyPart makeBodyPart(java.lang.String id, java.lang.String partName, java.lang.String cType, java.lang.String disp, java.lang.String desc, java.lang.String cid, java.io.InputStream ins)
          Makes a MimePart out of a message part
 void makecont(KomData ht, java.lang.String ref)
          Updates contents data for the parent object
(package private)  void makeform(java.lang.String frm, java.lang.String codes)
          Makes a form to be used when creating an object.
(package private)  java.lang.String makehtml(java.lang.String body)
          Adds headers and trailers to body text to make it proper HTML
 KomData makeoper(java.lang.String ref, KomData ht)
          Makes an "operation" to be added to the contents of an object
 KomData makerec(KomData ht, java.lang.String ref)
          Makes a receiver data structure from a KOM object
 KomData makerec(java.lang.String rec, java.lang.String type, java.lang.String name)
          Makes a receiver data structure
 KomData makerec(java.lang.String rec, java.lang.String type, java.lang.String name, java.lang.String shortname, java.lang.String email)
          Makes a receiver data structure
(package private)  javax.mail.internet.MimeBodyPart makeRelatedPart(KomData obj, java.lang.String id, java.lang.String text, javax.mail.internet.MimeMultipart oldpart)
          Makes a new multipart/related from an object, a text and possibly an older version of the part, plus a new inline part.
(package private)  javax.mail.internet.MimeBodyPart makeSimpleHTMLpart(java.lang.String body)
          Makes a simple text/html body part from a String
(package private)  void menufoot()
           
(package private)  void menuhead()
           
 java.lang.String messageid(java.lang.String id, KomData obj, java.lang.String vers, java.lang.String lang)
          Constructs a Message-ID from an object reference and/or from an object
 java.lang.String messageid(java.lang.String oid, java.lang.String uid)
          Constructs a Message-ID from an object reference and an id
(package private)  boolean mimeChange(KomData obj, java.lang.String oldmsg, java.lang.String newmsg, java.lang.String[] rmv)
          Checks for, and applies, changes to a MIME-formatted object.
 java.lang.String mkmbox(java.lang.String name)
          Creates a string, suitable as a mailbox identifier, from a string which may contain unsuitable characters.
 java.lang.String mkmbox(java.lang.String name, boolean tolower)
          Creates a string, suitable as a mailbox identifier, from a string which may contain unsuitable characters.
private  void moderate(KomData obj)
          Makes a page with a form for activity moderation
(package private)  void modifytype(KomData obj, java.lang.String remove, java.lang.String add)
          Modifies type code of an object by removing and/or adding some codes.
(package private)  javax.mail.internet.MimeBodyPart newMimeBodyPart(java.lang.Object c, java.lang.String ct)
           
 java.lang.String nntpServer(java.lang.String nntp, KomData obj)
          Defines an NNTP Usenet News server as a NewsClient instance If successful, the variable newsclient will point to an active NewsClient instance.
(package private)  void outpreview(KomData ht)
          Shows a preview of a message or presentation text
(package private)  void page(KomData ht)
          Builds common part of most pages
private  void setDefault(java.lang.String key, java.lang.String value)
          Sets a userData parameter, if no previous value exists
(package private)  void setDefaults()
          Sets userData defaults for some user parameters, if not set before
(package private)  void setUserValue(KomData ht, java.lang.String key, java.lang.String def)
          Copies a value from an object to the userData object
private  void showatts(KomData pt)
           
private  boolean special()
           
 int store(KomData obj, KomData ht, java.lang.String orig)
          Sends an object to a recipient
(package private)  void xform(boolean x, java.lang.String tmpl)
           
(package private)  void xform(boolean x, java.lang.String tmpl, KomData ht)
           
(package private)  void xform(boolean x, java.lang.String tmpl, KomData ht, java.lang.String codes)
           
(package private)  void xform(boolean x, java.lang.String tmpl, java.lang.String codes)
           
 
Methods inherited from class kom.gateway.News
addMem, bookmarks, checkNewMemb, checkUnseen, countmod, dispActNews, dispBook, dispCatNews, dispForumNews, dispLetterNews, dispModNews, dispMods, dispPersNews, dispSavedNews, dispSavedQueries, getRead, makeNews, markCat, markPres, markrecs, markSeen, newVote, nextUnread, putShort, storeNews, threadno
 
Methods inherited from class kom.gateway.Grade
catover, cretab, fetchGrade, fetchRate, getEvaluation, getgrade, isTeacher, listover, newGrade, printRatings, showcat, showgrades, shownumbers, showover, showstud, showuser
 
Methods inherited from class kom.gateway.Chat
addChat, chat, chatFetch, chatHeader, chatIndex, chatInput, chatList, chatOut, chatOutput, chatStore, checkEnter, enter, isActive, leave, leaveChat, pres, qchat, setUser, transform
 
Methods inherited from class kom.gateway.Form
, add, addBody, addv, checkHTML, checkHTTP, checkTag, checkVote, complete, contains, dispauth, dispbody, dispcheck, dispname, dispselect, disptype, form, form, form, form, formsegment, getAreaResult, getForm, getHTML, getOutputText, getQryValues, getResultBox, getResultText, getSelect1, getSelect2, getSelectResult, getTag, getVote, getVoteArea, getVoteCheck, getVoteSelect, getVoteSubmit, getVoteTag, getVoteText, insertSelect, makeHTML, nextmatching, normalize, restoreOutput, saveOutput, textareaSubst, transform, translate, trbody
 
Methods inherited from class kom.gateway.KOMutil
a, accessCont, accessCont, accessObj, addInfoData, addrToLocal, changeEnvironment, cidReplace, contType, decodeText, deleted, dispMailMessage, doAction, equal, excluded, fetchNews, findId, findId, findlocal, findLogin, findOwner, findUser, getActId, getcont, getcont, getcontV, getcontV, getCurNgd, getmemb, getMsgParts, getMsgText, getNews, getNewsAuth, getobj, getobject, getold, getParent, getPart, getSimpleFileName, getSimpleFileName, getStream, getTail, getTextPart, getVal, getVal, isAllowed, isarg, isMember, isOrganizer, isOrganizer, ispunct, isType, isValidEmailAddress, loggedIn, mailDate, mailDate, mimeMessage, mimeMessageStream, mkdate, mkdate, noQuote, parseArglist, parseArgs, setCids, setNewsAuth, setValidMsgPwd, showBody, showHeader, showHeader, showHeaders, showInputStream, showMailMessage, showMessage, showMultipart, toString, transbody, urlexpand, userGavePassword, userGavePassword, wrap
 
Methods inherited from class kom.gateway.DBHigh
addContent, addContent, addDraft, addInfo, addLast, addMember, addNews, addObj, addObj, addObject, addObject, addQuery, cleanDrafts, contentCount, createNews, depth, expungeRef, findContent, findDraft, findDraftData, findInfo, findMemb, findNews, findObject, findObject, findQuery, getFormContents, getQryDefault, getQueries, getseq, getStringValues, getValues, invalidateCount, isEmpty, isStandard, listDraft, makeArea, modObject, msgExists, nextDraft, queryExists, ref2path, refExists, removeDraft, removeQuery, replaceObject, Stream2String, String2Stream, StringBuffer2Stream, updateCount, updCount, updref, updseq
 
Methods inherited from class kom.gateway.DBLow
accessPart, addFile, areaExists, basedRef, createArea, debugLog, errorLog, expungeFile, File2Stream, File2String, findPart, getFile, getFileContents, getFileStream, getPath, getStandard, isMailSpool, lastModified, length, listFiles, makePart, msgPartStream, partfile, partpath, printStackTrace, readObject, removeFile, replaceMime, updseq1, validate, validate, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

modified

static boolean modified

curract

Build.KOMactivity curract
Current activity

SM

SendMail SM
Iff this object is a SendMail object, SM will be set to this"

kstephead

static final int kstephead

kPlogin

static final int kPlogin

kPloginpw

static final int kPloginpw

kPopenness

static final int kPopenness

kBrespondents

static final int kBrespondents

kPnewloccat

static final int kPnewloccat

kCnewlocname

static final int kCnewlocname

kPnewlocshort

static final int kPnewlocshort

kCnewmembermail

static final int kCnewmembermail

kCnameq

static final int kCnameq

kBintro

static final int kBintro

kPsecret

static final int kPsecret

kBalt

static final int kBalt

kBscale

static final int kBscale

ksteptail

static final int ksteptail

khead

static final int khead

kCnameq2

static final int kCnameq2

kBintro2

static final int kBintro2

kPsecret2

static final int kPsecret2

kBalt2

static final int kBalt2

kBscale2

static final int kBscale2

ktail

static final int ktail

qrytable

static final QueryElement[] qrytable
List describing html structure of query-wizard.
 formname,   page
     ^         ^
     |         |
     |      Specifies at which step this
     |      attribute will be asked of
     |      the user. 0 means that
     |      the form will be used on
     |      every page while in query-
     |      wizard mode. -1
     |      means that the form will be
     |      used when not in query-wizard
     |      mode.
     |
     |
  Specifies what form will be used
  for constructing html that will be
  presented to the user in the input
  phase. In case of a multi-valued
  attribute, form names name+head and
  name+tail are usually also used.

 

Sub-forms are placed linearly on the page, that is forms specified earlier in the array are presented before forms specified later. NB! If this table is changed, you must change the constants accordingly!

Constructor Detail

Build

public Build(ServerConfig config,
             HTTPResponse response,
             Gateway gateway)
Constructor
Parameters:
config - Server configuration data
response - HTTP response object
gateway - Client supervisor for this server instance
Method Detail

build

public java.io.InputStream build(java.lang.String uri,
                                 java.lang.String argl,
                                 char argdelim)
Constructs the response data for an action. Sets Content-Type and Content-Length of response.
Parameters:
uri - Request URI
argl - A possible set of name=value pairs, delimited by '&&'
Returns:
The relevant HTML page constructed from the database, as an InputStream

checkCDB

public boolean checkCDB()
Checks if CDB is set up, creates a part at a time if not.
Returns:
false if it is set up, otherwise true. In the latter case, a form for creating a missing part will have been created as value for the HTML page.

logout

public void logout()
Logs out the current user

contentHeaders

public java.io.InputStream contentHeaders(java.lang.String url,
                                          java.io.InputStream ins)
Defines content headers
Parameters:
url - URL
ins - InputStream for response

getHier

void getHier(KomData ht)
Sets up userData to reflect current object hierarchy.
Parameters:
ht - Current object (chosen via URI)

setUserValue

void setUserValue(KomData ht,
                  java.lang.String key,
                  java.lang.String def)
Copies a value from an object to the userData object
Parameters:
ht - Reference object data
key - Key for value
def - Default value, used if object does not have a value for key

page

void page(KomData ht)
Builds common part of most pages
Parameters:
ht - Data for object to be displayed

dispmain

void dispmain()
Displays top (main) menu bar.

displogin

void displogin(KomData ht)
Displays a login page
Parameters:
ht - Current chosen object

doLogin

public boolean doLogin(java.lang.String userref,
                       java.lang.String password)
Establishes a new current user. Updates userData to reflect the new user.
Parameters:
userref - User reference
password - User password as submitted
Returns:
true if login was successful

getUserNews

private void getUserNews(java.lang.String userref,
                         Build.KOMuser userobj)
Gets user news and stores it in newsData. If the database representation has become too bloated, it is reconstructed.
Parameters:
userref - Reference to user
userobj - User object

dispreg

void dispreg()
Displays page for registration

setDefaults

void setDefaults()
Sets userData defaults for some user parameters, if not set before

setDefault

private void setDefault(java.lang.String key,
                        java.lang.String value)
Sets a userData parameter, if no previous value exists
Parameters:
key - Parameter name
value - Parameter value

disphelp

void disphelp()
Displays a help page (in English or Swedish depending on the dialogue language parameter in userData).

dispdelete

void dispdelete(KomData ht)
Displays special forms if "delete=yes" or "delete=question" or "delete=expunge" are part of the invoking url, otherwise shows a "normal" form

dispinfo

void dispinfo(java.lang.String codes,
              boolean isorg)
Displays an index page showing users and forums
Parameters:
tmpl - Template
codes - Code letters
isorg - Add Member by an organiser

dispexcl

void dispexcl(KomData ht)
Displays an index page showing members in an activity
Parameters:
ht - Activity data
tmpl - Template

delete

void delete(KomData ht)
Shows result of delete operation, and records the operation.
Parameters:
ht - Deleted (or not) object

expunge

void expunge(KomData ht)
Shows result of expunge operation, and records the operation.
Parameters:
ht - Expunged (or not) object

getMimeRef

java.lang.String getMimeRef(KomData msg)

dispnormal

public void dispnormal(KomData ht)
Creates the "normal" part of the page for an object
Parameters:
ht - Object data

moderate

private void moderate(KomData obj)
Makes a page with a form for activity moderation
Parameters:
obj - Object for activity to be handled

history

private void history(KomData obj)
Shows the "history" of an activity
Parameters:
obj - Activity data

getThreads

int[] getThreads(java.lang.String[] opers)
Makes an array of indices, each referring to the last element of a thread.
Parameters:
opers - Vector of all elements. Indices will refer to this vector.
Returns:
int[] array, with -1 in the first unused element.

getObj

public KomData getObj(java.lang.String ref)
Gets an object (a subtype of KomData)
Parameters:
ref - Object id
Returns:
Depending on the value of ref, returns an object which is the relevant subtype of KomData

outpreview

void outpreview(KomData ht)
Shows a preview of a message or presentation text
Parameters:
ht - Object

showatts

private void showatts(KomData pt)

addrecs

void addrecs(KomData ht,
             java.lang.String cre)
Shows the proposed recipients of a message to be created
Parameters:
ht - Object to which message will relate (initially)
cre - Form id for recipient display

disppreview

void disppreview(KomData obj)
Shows the header part of a message/presentation text preview
Parameters:
obj - Object to which message will "belong"

disprecs

public void disprecs(KomData ht)
Displays recipients
Parameters:
ht - Object with rec*, cc* or par* records

dispparent

private void dispparent(KomData ht,
                        java.lang.String par)
Shows data for a parent
Parameters:
ht - Object (child)
par - Parent key ("father" or "mother")

getMessageId

public java.lang.String getMessageId(java.lang.String id)
Gets a message id from a thread part reference
Parameters:
id - /C/F/T/S (C = category, F = person or forum, T = thread, S = #)
Returns:
Existing msgid, or constructed.

getMt

public KomData getMt(java.lang.String id)
Gets message or thread
Parameters:
id - Object id
Returns:
proper subclass of KomData

messageid

public java.lang.String messageid(java.lang.String id,
                                  KomData obj,
                                  java.lang.String vers,
                                  java.lang.String lang)
Constructs a Message-ID from an object reference and/or from an object
Parameters:
id - Message object reference (may be null if obj != null)
obj - Object or null
vers - Not used at present, kept for poss. extensions
lang - Ditto
Returns:
Valid Message-ID of the form

messageid

public java.lang.String messageid(java.lang.String oid,
                                  java.lang.String uid)
Constructs a Message-ID from an object reference and an id
Parameters:
oid - Object id
uid - Creator id, usually
Returns:
Valid Message-ID of the form

makecont

public void makecont(KomData ht,
                     java.lang.String ref)
Updates contents data for the parent object
Parameters:
ht - Main object
ref - Ref to added object

makeoper

public KomData makeoper(java.lang.String ref,
                        KomData ht)
Makes an "operation" to be added to the contents of an object
Parameters:
ref - Object reference to be used as Pref value
ht - Object whose attributes are selectively copied
Returns:
KomData object containing the essential data from ht + data to define its place in the parent structure

makerec

public KomData makerec(KomData ht,
                       java.lang.String ref)
Makes a receiver data structure from a KOM object
Parameters:
ht - KOM object data
ref - Used as Prec value if ht has no Pid value
Returns:
KomData structure to be used as receiver data

makerec

public KomData makerec(java.lang.String rec,
                       java.lang.String type,
                       java.lang.String name)
Makes a receiver data structure
Parameters:
rec - Id of receiver
type - Type of receiver
name - Common name (activity title, subject or personal name)
Returns:
KomData structure to be used as receiver data

makerec

public KomData makerec(java.lang.String rec,
                       java.lang.String type,
                       java.lang.String name,
                       java.lang.String shortname,
                       java.lang.String email)
Makes a receiver data structure
Parameters:
rec - Id of receiver
type - Type of receiver
name - Common name (activity title, subject or personal name)
shortname - "mailbox" name
email - Email address
Returns:
KomData structure to be used as receiver data

mkmbox

public java.lang.String mkmbox(java.lang.String name)
Creates a string, suitable as a mailbox identifier, from a string which may contain unsuitable characters.
Parameters:
name - A string, usually a common name, which may contain spaces and other characters outside the valid set. The string is converted to lower case.
Returns:
a "sanitized" string with 7-bit characters and no spaces or repeated dots. Space is converted to '.', accented letters to plain letters.

mkmbox

public java.lang.String mkmbox(java.lang.String name,
                               boolean tolower)
Creates a string, suitable as a mailbox identifier, from a string which may contain unsuitable characters.
Parameters:
name - A string, usually a common name, which may contain spaces and other characters outside the valid set
tolower - If true, convert to lower case first
Returns:
a "sanitized" string with 7-bit characters and no spaces or repeated dots. Space is converted to '.', accented letters to plain letters.

mimeChange

boolean mimeChange(KomData obj,
                   java.lang.String oldmsg,
                   java.lang.String newmsg,
                   java.lang.String[] rmv)
Checks for, and applies, changes to a MIME-formatted object.
Parameters:
obj - KomData object - has reference(s) to MIME object(s)
oldmsg - Path to old message: either a standard ref ending in /, or a draft object reference, ending in /draftxNNN, where NNN is a decimal number
newmsg - Either: null, if oldmsg is to be modified, or a path like oldmsg
rmv - If non-null, contains part numbers of parts to be removed
Returns:
true if there was a change

newMimeBodyPart

javax.mail.internet.MimeBodyPart newMimeBodyPart(java.lang.Object c,
                                                 java.lang.String ct)
                                           throws javax.mail.MessagingException

makeRelatedPart

javax.mail.internet.MimeBodyPart makeRelatedPart(KomData obj,
                                                 java.lang.String id,
                                                 java.lang.String text,
                                                 javax.mail.internet.MimeMultipart oldpart)
Makes a new multipart/related from an object, a text and possibly an older version of the part, plus a new inline part.
Parameters:
obj - Object
id - Id of the message data
text - Text of the HTML part of the message
oldpart - Old version of the new multipart, or null
Returns:
(Updated) multipart/related, with links added in the text to the inline parts.

copyParts

void copyParts(javax.mail.internet.MimeMultipart from,
               javax.mail.internet.MimeMultipart to,
               javax.mail.internet.MimeBodyPart p0,
               java.lang.String text)
         throws javax.mail.MessagingException
Copies body parts from a multipart to another multipart, excluding parts whose Content-Id is not referred from the text.
Parameters:
from - Old multipart
to - New multipart
p0 - New Part 0
text - Text that should refer to the parts via cid:

makeSimpleHTMLpart

final javax.mail.internet.MimeBodyPart makeSimpleHTMLpart(java.lang.String body)
Makes a simple text/html body part from a String
Parameters:
body - Body text
Returns:
MimeBodyPart

makehtml

java.lang.String makehtml(java.lang.String body)
Adds headers and trailers to body text to make it proper HTML
Parameters:
body - Body text
Returns:
HTML text

addParts

void addParts(java.lang.String id,
              javax.mail.internet.MimeMultipart mp,
              Upload[] parts,
              java.lang.String disp)
Adds parts from an Upload array
Parameters:
mp - MimeMultipart instance
parts - Parts list
disp - Disposition (inline/attachment)

makeBodyPart

private javax.mail.internet.MimeBodyPart makeBodyPart(java.lang.String id,
                                                      java.lang.String partName,
                                                      java.lang.String cType,
                                                      java.lang.String disp,
                                                      java.lang.String desc,
                                                      java.lang.String cid,
                                                      java.io.InputStream ins)
Makes a MimePart out of a message part
Parameters:
id - Message id
partName - Part name
cType - Content-Type
disp - Disposition (inline/attachment)
desc - Content-Description string
cid - Content-Id string
Returns:
A MimeBodyPart with as accurate a Content-Type, etc, as possible

menuhead

void menuhead()

menufoot

void menufoot()

nntpServer

public java.lang.String nntpServer(java.lang.String nntp,
                                   KomData obj)
Defines an NNTP Usenet News server as a NewsClient instance If successful, the variable newsclient will point to an active NewsClient instance.
Parameters:
nntp - Server reference, e g "news.kth.se" or null for default server
obj - If non-null, the (normalized) server ref will be saved as obj."Pnntp"
Returns:
Error message, or "" if server is established ok.

getNewsClient

public NewsClient getNewsClient(Build.KOMactivity act,
                                java.lang.StringBuffer em)
Establishes a NewsClient for a (newsgroup) activity. Sets the value of newsclient if successful.
Parameters:
act - Activity object corresponding to a newsgroup
em - StringBuffer for possible error message
Returns:
NewsClient instance, or null (then, em will contain an error message)

store

public int store(KomData obj,
                 KomData ht,
                 java.lang.String orig)
Sends an object to a recipient
Parameters:
obj - Object to distribute
ht - Data for recipient
orig - Ref of original object, or null
Returns:
0 for local recipient, 1 for email recipient, 2 for newsgroup.

makeform

void makeform(java.lang.String frm,
              java.lang.String codes)
Makes a form to be used when creating an object. If user is not logged-in, asks for name.
Parameters:
frm - Form template name
codes - Code string

special

private final boolean special()

modifytype

void modifytype(KomData obj,
                java.lang.String remove,
                java.lang.String add)
Modifies type code of an object by removing and/or adding some codes. Example: modifytype(obj, MOD+THR, REP) removes any MOD and THR type code and adds type code REP to the Ptype field of obj.
Parameters:
obj - Object
remove - Codes to be removed, or null
add - Codes to be added, or null

xform

void xform(boolean x,
           java.lang.String tmpl)

xform

void xform(boolean x,
           java.lang.String tmpl,
           KomData ht)

xform

void xform(boolean x,
           java.lang.String tmpl,
           java.lang.String codes)

xform

void xform(boolean x,
           java.lang.String tmpl,
           KomData ht,
           java.lang.String codes)

getNewsGroupData

NewsGroupData getNewsGroupData(java.lang.String id)
Defines current newsgroup (curNgd = NewsGroupData instance)
Parameters:
id - Message, thread or activity id
Returns:
value of curNgd, established as current NewsGroupData instance, or null on failure

handleOverviews

void handleOverviews(Overview[] ot,
                     java.lang.String name,
                     java.lang.String actr,
                     Build.KOMactivity act)
Stores an array of Overview records as thread elements
Parameters:
ot - Array of Overview objects
name - Newsgroup name
actr - Ref to newsgroup activity
act - Newsgroup activity object

getAct

KomData getAct(java.lang.String id)
Gets activity object from an object reference.
Parameters:
id - Some reference
Returns:
Activity object for reference, if deep enough (/cat/act/...)

getRecop

public KomData getRecop(KomData rt)
Makes a recipient operation
Parameters:
rt - Basic recipient data
Returns:
A structure that can be used as a recipient operation

getKOMmsg

public Build.KOMmsg getKOMmsg(java.util.Vector v,
                              int i)
Creates a KOMmsg object from a vector element
Parameters:
v - Vector of messages in String form
i - Element index

getKOMmsg

public Build.KOMmsg getKOMmsg()
Creates an empty KOMmsg object

buildReferences

java.util.Vector buildReferences(java.lang.String[] prec,
                                 java.lang.String[] pnum,
                                 java.util.Hashtable beenThere)
Makes a vector of ids of messages referred to (recursively).
Parameters:
prec - Array of reference ids (thread ids)
pnum - Corresponding array of message seq numbers in threads
beenThere - Records all visited nodes to avoid loops
Returns:
Vector of message ids, without duplication, generated by recursively following the first references.