/* -*- IDL -*- * Copyright (C) 2001-2002, Christof Meerwald * http://JabXPCOM.sunsite.dk/ */ /* * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef IDL__JABXPCOM__INCLUDED #define IDL__JABXPCOM__INCLUDED #include "nsISupports.idl" #include "io//datastream.idl" #include "judoxpcom.idl" [scriptable, uuid(c9d6fe19-686a-48c4-809e-90522c3844a4)] interface jabIConstPacket : nsISupports { readonly attribute AUTF8String from; readonly attribute AUTF8String sender; // for languages where 'from' is a keyword readonly attribute AUTF8String to; readonly attribute AUTF8String id; readonly attribute AUTF8String error; readonly attribute long errorCode; readonly attribute judoIConstElement baseElement; /** * Just a shortcut for baseElement.findElement("x", "jabber:x:" + ext) */ judoIConstElement findExtension(in AUTF8String ext); AUTF8String toXML(); }; [scriptable, uuid(633ff0aa-e4e6-4247-b5a9-ca60c0fcbbb6)] interface jabIPacket : nsISupports { readonly attribute judoIElement baseElement; judoIElement addExtension(in AUTF8String ext); /** * Just a shortcut for baseElement.findElement("x", "jabber:x:" + ext) */ judoIElement findExtension(in AUTF8String ext); }; typedef unsigned long PresenceType; typedef unsigned long ShowType; [scriptable, uuid(61d528d1-ab14-45a9-83b5-a11734ee6619)] interface jabIPresence : jabIConstPacket { const PresenceType ptSubRequest = 0; const PresenceType ptUnsubRequest = 1; const PresenceType ptSubscribed = 2; const PresenceType ptUnsubscribed = 3; const PresenceType ptAvailable = 4; const PresenceType ptUnavailable = 5; const PresenceType ptError = 6; const PresenceType ptInvisible = 7; const ShowType stInvalid = 0; const ShowType stOffline = 1; const ShowType stOnline = 2; const ShowType stChat = 3; const ShowType stAway = 4; const ShowType stXA = 5; const ShowType stDND = 6; readonly attribute PresenceType type; readonly attribute ShowType show; readonly attribute AUTF8String status; readonly attribute AUTF8String showStr; readonly attribute long priority; /** * Create a presence reply to a presence request. * * @precondition show must either be ptSubRequest or ptUnsubRequest */ jabIPresence reply(in PresenceType ptype); }; interface jabIMessage; typedef unsigned long MessageType; [scriptable, uuid(44f2b5f6-2492-4845-907f-045601d494ae)] interface jabIConstMessage : jabIConstPacket { const MessageType mtNormal = 0; const MessageType mtError = 1; const MessageType mtChat = 2; const MessageType mtGroupchat = 3; const MessageType mtHeadline = 4; readonly attribute AUTF8String body; readonly attribute AUTF8String subject; readonly attribute AUTF8String dateTime; readonly attribute AUTF8String thread; readonly attribute MessageType type; /** * Create a reply message to this message. */ jabIMessage reply(in AUTF8String body); AUTF8String getHtmlBody(); }; [scriptable, uuid(c09ebdc7-09ec-462d-9c3c-fcee2b774d94)] interface jabIMessage : jabIConstMessage { void setSubject(in AUTF8String subject); void setThread(in AUTF8String thread); void setHtmlBody(in AUTF8String html_body); }; interface jabIInfoQuery; typedef unsigned long InfoQueryType; [scriptable, uuid(ebb1c851-801c-4f95-8687-2132e6665522)] interface jabIConstInfoQuery : jabIConstPacket { const InfoQueryType iqtGet = 0; const InfoQueryType iqtSet = 1; const InfoQueryType iqtResult = 2; const InfoQueryType iqtError = 3; readonly attribute InfoQueryType type; /** * Just a shortcut for baseElement.findElement("query") */ judoIConstElement getQuery(); /** * Create a result iq packet. */ jabIInfoQuery reply(); }; [scriptable, uuid(6d13d8ea-1f64-4a25-8f73-2a45d6f03017)] interface jabIInfoQuery : jabIConstInfoQuery { judoIElement addQuery(in AUTF8String iq_ns); }; [scriptable, uuid(8b097c37-118a-4d50-b606-2ecc5f2816cc)] interface jabISessionEvtConnected : nsISupports { void onConnected(in judoIConstElement element); }; [scriptable, uuid(e8726c7e-2e6d-4fe5-8b88-83b103f45444)] interface jabISessionEvtDisconnected : nsISupports { void onDisconnected(); }; [scriptable, uuid(d1216bda-5b2c-468f-875c-f668c445b566)] interface jabISessionEvtAuthError : nsISupports { void onAuthError(in long code, in AUTF8String data); }; [scriptable, uuid(681da144-be50-46d6-9599-e84fb6c6bae9)] interface jabISessionEvtIq : nsISupports { void onIq(in judoIConstElement element); }; [scriptable, uuid(4fc733dc-44a3-4079-8f35-eaffc3d728e2)] interface jabISessionEvtMessage : nsISupports { void onMessage(in jabIConstMessage message); }; [scriptable, uuid(eafc40c4-d9c9-4d79-a905-e186781b233f)] interface jabISessionEvtUnknownPacket : nsISupports { void onUnknownPacket(in judoIConstElement element); }; [scriptable, uuid(e5e3d866-c331-464c-b213-32b1ac036bfb)] interface jabISessionEvtIqVersion : nsISupports { void onIqVersion(out AUTF8String name, out AUTF8String version, out AUTF8String os); }; [scriptable, uuid(161d49b7-332b-4c35-8f62-b6f1612edb2f)] interface jabISessionEvtIqLast : nsISupports { /** * @param seconds seconds since last activity */ void onIqLast(out AUTF8String seconds); }; [scriptable, uuid(0b56dc04-d03a-4532-851e-583d68b96269)] interface jabISessionEvtPresence : nsISupports { void onPresence(in jabIPresence presence, in PresenceType prev_type); }; [scriptable, uuid(b092b2a1-3439-4ce3-a8cb-4dc5e2adc540)] interface jabISessionEvtPresenceRequest : nsISupports { void onPresenceRequest(in jabIPresence presence); }; typedef unsigned long AuthType; typedef unsigned long ConnectionState; [scriptable, uuid(df62530d-4d2d-43e5-8028-16d25fc5789e)] interface jabISession : nsISupports { const AuthType atPlaintextAuth = 0; const AuthType atDigestAuth = 1; const AuthType atAutoAuth = 2; const AuthType at0kAuth = 3; const ConnectionState csNotConnected = 0; const ConnectionState csCreateUser = 1; const ConnectionState csAuthReq = 2; const ConnectionState csAwaitingAuth = 3; const ConnectionState csConnected = 4; // attributes readonly attribute jabIDataStream inputStream; attribute jabIDataStream outputStream; readonly attribute ConnectionState connState; readonly attribute AUTF8String userName; // events unsigned long connectEvtConnected(in jabISessionEvtConnected slot); void disconnectEvtConnected(in unsigned long id); unsigned long connectEvtDisconnected(in jabISessionEvtDisconnected slot); void disconnectEvtDisconnected(in unsigned long id); unsigned long connectEvtAuthError(in jabISessionEvtAuthError slot); void disconnectEvtAuthError(in unsigned long id); unsigned long connectEvtIq(in jabISessionEvtIq slot); void disconnectEvtIq(in unsigned long id); unsigned long connectEvtMessage(in jabISessionEvtMessage slot); void disconnectEvtMessage(in unsigned long id); unsigned long connectEvtUnknownPacket(in jabISessionEvtUnknownPacket slot); void disconnectEvtUnknownPacket(in unsigned long id); unsigned long connectEvtIqVersion(in jabISessionEvtIqVersion slot); void disconnectEvtIqVersion(in unsigned long id); unsigned long connectEvtIqLast(in jabISessionEvtIqLast slot); void disconnectEvtIqLast(in unsigned long id); unsigned long connectEvtPresence(in jabISessionEvtPresence slot); void disconnectEvtPresence(in unsigned long id); unsigned long connectEvtPresenceRequest(in jabISessionEvtPresenceRequest slot); void disconnectEvtPresenceRequest(in unsigned long id); void connect(in AUTF8String server, in AuthType atype, in AUTF8String username, in AUTF8String resource, in AUTF8String password, in boolean createuser); boolean disconnect(); AUTF8String getNextID(); // some factory methods jabIMessage createMessage(in AUTF8String jid, in AUTF8String body, in MessageType mtype); jabIInfoQuery createInfoQuery(in AUTF8String jid, in InfoQueryType iqtype); jabIPresence createPresence(in AUTF8String jid, in PresenceType ptype, in ShowType stype, in AUTF8String status, in long priority); jabIPresence createPresenceRequest(in AUTF8String jid, in PresenceType ptype); jabIPresence createMyPresence(in PresenceType ptype, in ShowType stype, in AUTF8String status, in long priority); void sendPacket(in jabIConstPacket packet); }; #endif