| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2024-03-04 18:04:47 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2024-03-04 18:04:47 UTC |
| parent | beffd7687d99789e8ae3911bb4021a23be17d9a0 |
| HaxeCBridge.hx | +38 | -42 |
| cpp.hxml | +3 | -3 |
| {xmpp => snikket}/Auolink.hx | +0 | -0 |
| {xmpp => snikket}/Autolink.hx | +2 | -2 |
| {xmpp => snikket}/Caps.hx | +1 | -1 |
| {xmpp => snikket}/Chat.hx | +12 | -12 |
| {xmpp => snikket}/ChatMessage.hx | +7 | -7 |
| {xmpp => snikket}/Client.hx | +42 | -31 |
| {xmpp => snikket}/Color.hx | +1 | -1 |
| {xmpp => snikket}/Date.hx | +1 | -1 |
| {xmpp => snikket}/EmojiUtil.hx | +1 | -1 |
| {xmpp => snikket}/EventEmitter.hx | +2 | -2 |
| {xmpp => snikket}/EventHandler.hx | +1 | -1 |
| {xmpp => snikket}/FSM.hx | +1 | -1 |
| {xmpp => snikket}/GenericStream.hx | +3 | -3 |
| {xmpp => snikket}/ID.hx | +1 | -1 |
| {xmpp => snikket}/Identicon.hx | +2 | -2 |
| {xmpp => snikket}/JID.hx | +1 | -1 |
| {xmpp => snikket}/Map.js.hx | +1 | -1 |
| {xmpp => snikket}/Message.hx | +1 | -1 |
| {xmpp => snikket}/MessageSync.hx | +6 | -6 |
| {xmpp => snikket}/Notification.hx | +3 | -3 |
| {xmpp => snikket}/PeerConnection.js.hx | +0 | -0 |
| {xmpp => snikket}/Persistence.hx | +4 | -4 |
| {xmpp => snikket}/Presence.hx | +1 | -1 |
| {xmpp => snikket}/PubsubEvent.hx | +1 | -1 |
| {xmpp => snikket}/Push.hx | +6 | -6 |
| {xmpp => snikket}/ReactionUpdate.hx | +1 | -1 |
| {xmpp => snikket}/ResultSet.hx | +1 | -1 |
| {xmpp => snikket}/Stanza.hx | +1 | -1 |
| snikket/Stream.cpp.hx | +5 | -0 |
| snikket/Stream.js.hx | +5 | -0 |
| {xmpp => snikket}/StringUtil.hx | +1 | -1 |
| {xmpp => snikket}/XEP0393.hx | +3 | -3 |
| {xmpp => snikket}/jingle/Group.hx | +1 | -1 |
| {xmpp => snikket}/jingle/IceServer.hx | +1 | -1 |
| {xmpp => snikket}/jingle/PeerConnection.cpp.hx | +1 | -1 |
| {xmpp => snikket}/jingle/PeerConnection.js.hx | +1 | -1 |
| {xmpp => snikket}/jingle/Session.hx | +4 | -4 |
| {xmpp => snikket}/jingle/SessionDescription.hx | +1 | -1 |
| {xmpp => snikket}/persistence/Sqlite.hx | +4 | -4 |
| {xmpp => snikket}/persistence/browser.js | +0 | -0 |
| {xmpp => snikket}/queries/DiscoInfoGet.hx | +7 | -7 |
| {xmpp => snikket}/queries/DiscoItemsGet.hx | +7 | -7 |
| {xmpp => snikket}/queries/ExtDiscoGet.hx | +7 | -7 |
| {xmpp => snikket}/queries/GenericQuery.hx | +2 | -2 |
| {xmpp => snikket}/queries/HttpUploadSlot.hx | +7 | -7 |
| {xmpp => snikket}/queries/JabberIqGatewayGet.hx | +7 | -7 |
| {xmpp => snikket}/queries/MAMQuery.hx | +6 | -6 |
| {xmpp => snikket}/queries/PubsubGet.hx | +6 | -6 |
| {xmpp => snikket}/queries/Push2Enable.hx | +4 | -4 |
| {xmpp => snikket}/queries/RosterGet.hx | +6 | -6 |
| {xmpp => snikket}/queries/VcardTempGet.hx | +6 | -6 |
| {xmpp => snikket}/streams/XmppJsStream.hx | +4 | -4 |
| {xmpp => snikket}/streams/XmppStropheStream.hx | +4 | -4 |
| xmpp/Stream.cpp.hx | +0 | -5 |
| xmpp/Stream.js.hx | +0 | -5 |
diff --git a/HaxeCBridge.hx b/HaxeCBridge.hx index 76cf7a2..fb41060 100644 --- a/HaxeCBridge.hx +++ b/HaxeCBridge.hx @@ -303,7 +303,7 @@ class HaxeCBridge { if (cNameMeta != null) [cNameMeta]; else - [libName] + [false ? libName : ""] // NOTE: probably want this if we get packages with differnt name? .concat(safeIdent(classPrefix.join('.')) != libName ? classPrefix : []) .filter(s -> s != ''); @@ -326,7 +326,7 @@ class HaxeCBridge { t: TInst(clsRef, []), // return a instance of this class } case Member: - var instanceTArg: TVar = {id: -1, name: 'instance', t: TInst(clsRef, []), meta: null, capture: false, extra: null}; + var instanceTArg: TVar = {id: -1, name: hx.strings.Strings.toLowerUnderscore(classPrefix[classPrefix.length - 1]), t: TInst(clsRef, []), meta: null, capture: false, extra: null}; { args: [{v: instanceTArg, value: null}].concat(tfunc.args), expr: tfunc.expr, @@ -346,6 +346,8 @@ class HaxeCBridge { else functionPrefix.concat([f.name]).join('_'); + cFuncName = hx.strings.Strings.toLowerUnderscore(cFuncName); + var cleanDoc = f.doc != null ? StringTools.trim(removeIndentation(f.doc)) : null; cConversionContext.addTypedFunctionDeclaration(cFuncName, functionDescriptor, cleanDoc, f.pos); @@ -433,16 +435,8 @@ class HaxeCBridge { var prefix = isDynamicLink() ? 'API_PREFIX' : ''; return code(' - /** - * $namespace.h - * ${isLibraryBuild() ? - 'Automatically generated by HaxeCBridge' : - '! Warning, binary not generated as a library, make sure to add `-D dll_link` or `-D static_link` when compiling the haxe project !' - } - */ - - #ifndef HaxeCBridge_${namespace}_h - #define HaxeCBridge_${namespace}_h + #ifndef __${hx.strings.Strings.toUpperUnderscore(namespace)}_H + #define __${hx.strings.Strings.toUpperUnderscore(namespace)}_h ') + (if (includes.length > 0) includes.map(CPrinter.printInclude).join('\n') + '\n\n'; else '') + (if (ctx.macros.length > 0) ctx.macros.join('\n') + '\n' else '') @@ -460,7 +454,7 @@ class HaxeCBridge { '); } else '') - + 'typedef void (* HaxeExceptionCallback) (const char* exceptionInfo);\n' + + 'typedef void (* SnikketPanicCallback) (const char* exceptionInfo);\n' + (if (ctx.supportTypeDeclarations.length > 0) ctx.supportTypeDeclarations.map(d -> CPrinter.printDeclaration(d, true)).join(';\n') + ';\n\n'; else '') + (if (ctx.typeDeclarations.length > 0) ctx.typeDeclarations.map(d -> CPrinter.printDeclaration(d, true)).join(';\n') + ';\n'; else '') @@ -471,29 +465,27 @@ class HaxeCBridge { #endif /** - * Initializes a haxe thread that executes the haxe main() function remains alive indefinitely until told to stop. + * Initializes the SDK * - * This must be first before calling haxe functions (otherwise those calls will hang waiting for a response from the haxe thread). + * This must be first before calling SDK functions (otherwise those calls will hang waiting for a response). * - * @param unhandledExceptionCallback a callback to execute if an unhandled exception occurs on the haxe thread. The haxe thread will continue processing events after an unhandled exception and you may want to stop it after receiving this callback. Use `NULL` for no callback + * @param panicCallback a callback to execute if the SDK panics. The SDK will continue processing events after a panic and you may want to stop it after receiving this callback. Use `NULL` for no callback * @returns `NULL` if the thread initializes successfully or a null-terminated C string if an error occurs during initialization */ - $prefix const char* ${namespace}_initializeHaxeThread(HaxeExceptionCallback unhandledExceptionCallback); + $prefix const char *${namespace}_setup(SnikketPanicCallback panicCallback); /** - * Stops the haxe thread, blocking until the thread has completed. Once ended, it cannot be restarted (this is because static variable state will be retained from the last run). + * Stops the SDK, blocking until the main thread has completed. Once ended, it cannot be restarted (this is because static variable state will be retained from the last run). * - * Other threads spawned from the haxe thread may still be running (you must arrange to stop these yourself for safe app shutdown). - * - * It can be safely called any number of times – if the haxe thread is not running this function will just return. + * It can be safely called any number of times – if the SDK is not running this function will just return. * - * After executing no more calls to main-thread haxe functions can be made (as these will hang waiting for a response from the main thread). + * After executing no more calls to SDK functions can be made (as these will hang waiting for a response). * - * Thread-safety: Can be called safely called on any thread. If called on the haxe thread it will trigger the thread to stop but it cannot then block until stopped. + * Thread-safety: Can be called safely called on any thread. * - * @param waitOnScheduledEvents If `true`, this function will wait for all events scheduled to execute in the future on the haxe thread to complete – this is the same behavior as running a normal hxcpp program. If `false`, immediate pending events will be finished and the thread stopped without executing events scheduled in the future + * @param waitOnScheduledEvents If `true`, this function will wait for all events scheduled to execute in the future on the SDK thread to complete. If `false`, immediate pending events will be finished and the SDK stopped without executing events scheduled in the future */ - $prefix void ${namespace}_stopHaxeThreadIfRunning(bool waitOnScheduledEvents); + $prefix void ${namespace}_stop(bool waitOnScheduledEvents); ') + indent(1, ctx.supportFunctionDeclarations.map(fn -> CPrinter.printDeclaration(fn, true, prefix)).join(';\n\n') + ';\n\n') @@ -506,7 +498,7 @@ class HaxeCBridge { #undef API_PREFIX - #endif /* HaxeCBridge_${namespace}_h */ + #endif '); } @@ -586,7 +578,7 @@ class HaxeCBridge { std::atomic<bool> staticsInitialized = { false }; struct HaxeThreadData { - HaxeExceptionCallback haxeExceptionCallback; + SnikketPanicCallback haxeExceptionCallback; const char* initExceptionInfo; }; @@ -640,7 +632,7 @@ class HaxeCBridge { threadData->initExceptionInfo = nullptr; // copy out callback - HaxeExceptionCallback haxeExceptionCallback = threadData->haxeExceptionCallback; + SnikketPanicCallback haxeExceptionCallback = threadData->haxeExceptionCallback; bool firstRun = !HaxeCBridgeInternal::staticsInitialized; @@ -671,7 +663,7 @@ class HaxeCBridge { } HAXE_C_BRIDGE_LINKAGE - const char* ${namespace}_initializeHaxeThread(HaxeExceptionCallback unhandledExceptionCallback) { + const char* ${namespace}_setup(SnikketPanicCallback unhandledExceptionCallback) { HaxeCBridgeInternal::HaxeThreadData threadData; threadData.haxeExceptionCallback = unhandledExceptionCallback == nullptr ? HaxeCBridgeInternal::defaultExceptionHandler : unhandledExceptionCallback; threadData.initExceptionInfo = nullptr; @@ -693,7 +685,7 @@ class HaxeCBridge { } if (threadData.initExceptionInfo != nullptr) { - ${namespace}_stopHaxeThreadIfRunning(false); + ${namespace}_stop(false); const int returnInfoMax = 1024; static char returnInfo[returnInfoMax] = ""; // statically allocated for return safety @@ -705,7 +697,7 @@ class HaxeCBridge { } HAXE_C_BRIDGE_LINKAGE - void ${namespace}_stopHaxeThreadIfRunning(bool waitOnScheduledEvents) { + void ${namespace}_stop(bool waitOnScheduledEvents) { if (HaxeCBridgeInternal::isHaxeMainThread()) { // it is possible for stopHaxeThread to be called from within the haxe thread, while another thread is waiting on for the thread to end // so it is important the haxe thread does not wait on certain locks @@ -728,7 +720,7 @@ class HaxeCBridge { } HAXE_C_BRIDGE_LINKAGE - void ${namespace}_free(const void* objPtr) { + void ${namespace}_release(const void* objPtr) { struct Callback { static void run(void* data) { HaxeCBridge::releaseHaxePtr(data); @@ -1000,6 +992,10 @@ class CPrinter { public static function printType(cType: CType, argName: Null<String> = null): String { return switch cType { + case Ident('HaxeString', modifiers): + (hasModifiers(modifiers) ? (printModifiers(modifiers) + ' ') : '') + "const char *" + (argName == null ? '' : ' $argName'); + case Ident('HaxeObject', modifiers): + (hasModifiers(modifiers) ? (printModifiers(modifiers) + ' ') : '') + "void *" + (argName == null ? '' : ' $argName'); case Ident(name, modifiers): (hasModifiers(modifiers) ? (printModifiers(modifiers) + ' ') : '') + name + (argName == null ? '' : ' $argName'); case Pointer(t, modifiers): @@ -1054,7 +1050,7 @@ class CPrinter { var name = signature.name; var args = signature.args; var ret = signature.ret; - return '${printType(ret)} $name(${args.map(arg -> '${printType(arg.type, arg.name)}').join(', ')})'; + return '${printType(ret)} $name(${args.map(arg -> '${printType(arg.type, arg.name)}').join(', ')})'.replace(" * ", " *").replace("(* ", "(*").replace("* ", " *"); } public static function printDoc(doc: String) { @@ -1547,9 +1543,9 @@ class CConverterContext { function getHaxeObjectCType(t: Type): CType { // in the future we could specialize based on t (i.e. generating another typedef name like HaxeObject_SomeType) var typeIdent = 'HaxeObject'; - var functionIdent = '${declarationPrefix}_free'; + var functionIdent = '${declarationPrefix}_release'; - if (!supportDeclaredTypeIdentifiers.exists(typeIdent)) { + /*if (!supportDeclaredTypeIdentifiers.exists(typeIdent)) { supportTypeDeclarations.push({ kind: Typedef(Pointer(Ident('void')), [typeIdent]), doc: code(' @@ -1557,7 +1553,7 @@ class CConverterContext { When passed from haxe to C, a reference to the object is retained to prevent garbage collection. You should call ${functionIdent} when finished with this handle in C to allow collection.') }); supportDeclaredTypeIdentifiers.set(typeIdent, true); - } + }*/ if (!supportDeclaredFunctionIdentifiers.exists(functionIdent)) { supportFunctionDeclarations.push({ @@ -1568,10 +1564,10 @@ class CConverterContext { Thread-safety: can be called on any thread. - @param haxeObject a handle to an arbitrary haxe object returned from a haxe function'), + @param objPtr a handle to an arbitrary haxe object returned from a haxe function'), kind: Function({ name: functionIdent, - args: [{name: 'haxeObject', type: Ident("const void*")}], + args: [{name: 'objPtr', type: Ident("const void*")}], ret: Ident('void') }) }); @@ -1585,9 +1581,9 @@ class CConverterContext { getHaxeObjectCType(null); // Make sure free is set up // in the future we could specialize based on t (i.e. generating another typedef name like HaxeObject_SomeType) var typeIdent = 'HaxeString'; - var functionIdent = '${declarationPrefix}_free'; + var functionIdent = '${declarationPrefix}_release'; - if (!supportDeclaredTypeIdentifiers.exists(typeIdent)) { + /*if (!supportDeclaredTypeIdentifiers.exists(typeIdent)) { supportTypeDeclarations.push({ kind: Typedef(Pointer(Ident("char", [Const])), [typeIdent]), doc: code(' @@ -1595,7 +1591,7 @@ class CConverterContext { When passed from haxe to C, a reference to the object is retained to prevent garbage collection. You should call ${functionIdent} when finished with this handle to allow collection.') }); supportDeclaredTypeIdentifiers.set(typeIdent, true); - } + }*/ if (false && !supportDeclaredFunctionIdentifiers.exists(functionIdent)) { supportFunctionDeclarations.push({ @@ -1663,7 +1659,7 @@ class CConverterContext { "auto", "double", "int", "struct", "break", "else", "long", "switch", "case", "enum", "register", "typedef", "char", "extern", "return", "union", "const", "float", "short", "unsigned", "continue", "for", "signed", "void", "default", "goto", "sizeof", "volatile", "do", "if", "static", "while", "size_t", "int64_t", "uint64_t", // HaxeCBridge types - "HaxeObject", "HaxeExceptionCallback", + "HaxeObject", "SnikketPanicCallback", // hxcpp "Int", "String", "Float", "Dynamic", "Bool", ]; diff --git a/cpp.hxml b/cpp.hxml index 18d08c1..28d7c4e 100644 --- a/cpp.hxml +++ b/cpp.hxml @@ -5,9 +5,9 @@ --library sha HaxeCBridge -xmpp.Client -xmpp.Push -xmpp.persistence.Sqlite +snikket.Client +snikket.Push +snikket.persistence.Sqlite --cpp cpp -D HaxeCBridge.name=snikket diff --git a/xmpp/Auolink.hx b/snikket/Auolink.hx similarity index 100% rename from xmpp/Auolink.hx rename to snikket/Auolink.hx diff --git a/xmpp/Autolink.hx b/snikket/Autolink.hx similarity index 99% rename from xmpp/Autolink.hx rename to snikket/Autolink.hx index 200afb2..1a31de9 100644 --- a/xmpp/Autolink.hx +++ b/snikket/Autolink.hx @@ -20,9 +20,9 @@ * * */ -package xmpp; +package snikket; -import xmpp.Stanza; +import snikket.Stanza; using Lambda; class Autolink { diff --git a/xmpp/Caps.hx b/snikket/Caps.hx similarity index 99% rename from xmpp/Caps.hx rename to snikket/Caps.hx index 23e5b9f..6d6e934 100644 --- a/xmpp/Caps.hx +++ b/snikket/Caps.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; import haxe.crypto.Base64; import haxe.crypto.Sha1; diff --git a/xmpp/Chat.hx b/snikket/Chat.hx similarity index 98% rename from xmpp/Chat.hx rename to snikket/Chat.hx index ff0f82b..e96ddc4 100644 --- a/xmpp/Chat.hx +++ b/snikket/Chat.hx @@ -1,19 +1,19 @@ -package xmpp; +package snikket; #if cpp import HaxeCBridge; #end import haxe.io.BytesData; -import xmpp.Chat; -import xmpp.ChatMessage; -import xmpp.Color; -import xmpp.GenericStream; -import xmpp.ID; -import xmpp.MessageSync; -import xmpp.jingle.PeerConnection; -import xmpp.jingle.Session; -import xmpp.queries.DiscoInfoGet; -import xmpp.queries.MAMQuery; +import snikket.Chat; +import snikket.ChatMessage; +import snikket.Color; +import snikket.GenericStream; +import snikket.ID; +import snikket.MessageSync; +import snikket.jingle.PeerConnection; +import snikket.jingle.Session; +import snikket.queries.DiscoInfoGet; +import snikket.queries.MAMQuery; using Lambda; enum UiState { @@ -32,7 +32,7 @@ abstract class Chat { private var presence:Map<String, Presence> = []; private var trusted:Bool = false; public var chatId(default, null):String; - public var jingleSessions: Map<String, xmpp.jingle.Session> = []; + public var jingleSessions: Map<String, snikket.jingle.Session> = []; private var displayName:String; @HaxeCBridge.noemit public var uiState = Open; diff --git a/xmpp/ChatMessage.hx b/snikket/ChatMessage.hx similarity index 98% rename from xmpp/ChatMessage.hx rename to snikket/ChatMessage.hx index 529046e..222fb5d 100644 --- a/xmpp/ChatMessage.hx +++ b/snikket/ChatMessage.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; import haxe.crypto.Base64; import haxe.io.Bytes; @@ -6,12 +6,12 @@ import haxe.io.BytesData; import haxe.Exception; using Lambda; -import xmpp.JID; -import xmpp.Identicon; -import xmpp.StringUtil; -import xmpp.XEP0393; -import xmpp.EmojiUtil; -import xmpp.Message; +import snikket.JID; +import snikket.Identicon; +import snikket.StringUtil; +import snikket.XEP0393; +import snikket.EmojiUtil; +import snikket.Message; class ChatAttachment { public final name: Null<String>; diff --git a/xmpp/Client.hx b/snikket/Client.hx similarity index 95% rename from xmpp/Client.hx rename to snikket/Client.hx index d825b12..165bf94 100644 --- a/xmpp/Client.hx +++ b/snikket/Client.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; #if cpp import HaxeCBridge; @@ -8,31 +8,31 @@ import sha.SHA256; import haxe.crypto.Base64; import haxe.io.Bytes; import haxe.io.BytesData; -import xmpp.jingle.IceServer; -import xmpp.Caps; -import xmpp.Chat; -import xmpp.ChatMessage; -import xmpp.Message; -import xmpp.EventEmitter; -import xmpp.EventHandler; -import xmpp.PubsubEvent; -import xmpp.Stream; -import xmpp.jingle.Session; -import xmpp.queries.DiscoInfoGet; -import xmpp.queries.DiscoItemsGet; -import xmpp.queries.ExtDiscoGet; -import xmpp.queries.GenericQuery; -import xmpp.queries.HttpUploadSlot; -import xmpp.queries.JabberIqGatewayGet; -import xmpp.queries.PubsubGet; -import xmpp.queries.Push2Enable; -import xmpp.queries.RosterGet; -import xmpp.queries.VcardTempGet; +import snikket.jingle.IceServer; +import snikket.Caps; +import snikket.Chat; +import snikket.ChatMessage; +import snikket.Message; +import snikket.EventEmitter; +import snikket.EventHandler; +import snikket.PubsubEvent; +import snikket.Stream; +import snikket.jingle.Session; +import snikket.queries.DiscoInfoGet; +import snikket.queries.DiscoItemsGet; +import snikket.queries.ExtDiscoGet; +import snikket.queries.GenericQuery; +import snikket.queries.HttpUploadSlot; +import snikket.queries.JabberIqGatewayGet; +import snikket.queries.PubsubGet; +import snikket.queries.Push2Enable; +import snikket.queries.RosterGet; +import snikket.queries.VcardTempGet; using Lambda; @:expose @:build(HaxeCBridge.expose()) -class Client extends xmpp.EventEmitter { +class Client extends EventEmitter { private var stream:GenericStream; private var chatMessageHandlers: Array<(ChatMessage)->Void> = []; public var jid(default,null):JID; @@ -58,9 +58,15 @@ class Client extends xmpp.EventEmitter { private var _displayName: String; private var fastMechanism: Null<String> = null; - public function new(jid: String, persistence: Persistence) { + /** + Create a new Client to connect to a particular account + + @param address the account to connect to + @param persistence the persistence layer to use for storage + **/ + public function new(address: String, persistence: Persistence) { super(); - this.jid = JID.parse(jid); + this.jid = JID.parse(address); this._displayName = this.jid.node; this.persistence = persistence; stream = new Stream(); @@ -185,7 +191,7 @@ class Client extends xmpp.EventEmitter { } final chat = this.getDirectChat(JID.parse(pubsubEvent.getFrom()).asBare().asString(), false); chat.setAvatarSha1(avatarSha1); - persistence.storeChat(jid, chat); + persistence.storeChat(accountId(), chat); persistence.getMediaUri("sha-1", avatarSha1, (uri) -> { if (uri == null) { final pubsubGet = new PubsubGet(pubsubEvent.getFrom(), "urn:xmpp:avatar:data", avatarSha1Hex); @@ -227,7 +233,7 @@ class Client extends xmpp.EventEmitter { chat.jingleSessions.remove(session.sid); } } else { - final newSession = xmpp.jingle.InitiatedSession.fromSessionInitiate(this, stanza); + final newSession = snikket.jingle.InitiatedSession.fromSessionInitiate(this, stanza); chat.jingleSessions.set(newSession.sid, newSession); chatActivity(chat); newSession.ring(); @@ -270,7 +276,7 @@ class Client extends xmpp.EventEmitter { stream.onIq(Set, "query", "jabber:iq:roster", (stanza) -> { if ( stanza.attr.get("from") != null && - stanza.attr.get("from") != JID.parse(jid).domain + stanza.attr.get("from") != jid.domain ) { return IqNoResult; } @@ -304,7 +310,7 @@ class Client extends xmpp.EventEmitter { } if (c == null) { chat.setPresence(JID.parse(stanza.attr.get("from")).resource, new Presence(null, mucUser)); - persistence.storeChat(jid, chat); + persistence.storeChat(accountId(), chat); if (chat.livePresence()) this.trigger("chats/update", [chat]); } else { persistence.getCaps(c.attr.get("ver"), (caps) -> { @@ -313,13 +319,13 @@ class Client extends xmpp.EventEmitter { discoGet.onFinished(() -> { chat.setPresence(JID.parse(stanza.attr.get("from")).resource, new Presence(discoGet.getResult(), mucUser)); if (discoGet.getResult() != null) persistence.storeCaps(discoGet.getResult()); - persistence.storeChat(jid, chat); + persistence.storeChat(accountId(), chat); if (chat.livePresence()) this.trigger("chats/update", [chat]); }); sendQuery(discoGet); } else { chat.setPresence(JID.parse(stanza.attr.get("from")).resource, new Presence(caps, mucUser)); - persistence.storeChat(jid, chat); + persistence.storeChat(accountId(), chat); if (chat.livePresence()) this.trigger("chats/update", [chat]); } }); @@ -358,7 +364,7 @@ class Client extends xmpp.EventEmitter { } // Maybe in the future record it as offine rather than removing it chat.removePresence(JID.parse(stanza.attr.get("from")).resource); - persistence.storeChat(jid, chat); + persistence.storeChat(accountId(), chat); this.trigger("chats/update", [chat]); } @@ -366,6 +372,11 @@ class Client extends xmpp.EventEmitter { }); } + /** + Get the account ID for this Client + + @return account id + **/ public function accountId() { return jid.asBare().asString(); } diff --git a/xmpp/Color.hx b/snikket/Color.hx similarity index 98% rename from xmpp/Color.hx rename to snikket/Color.hx index ad15120..537992c 100644 --- a/xmpp/Color.hx +++ b/snikket/Color.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; import hsluv.Hsluv; import haxe.io.Bytes; diff --git a/xmpp/Date.hx b/snikket/Date.hx similarity index 95% rename from xmpp/Date.hx rename to snikket/Date.hx index c56db31..51aeff4 100644 --- a/xmpp/Date.hx +++ b/snikket/Date.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; class Date { public static function format(d: std.Date):String { diff --git a/xmpp/EmojiUtil.hx b/snikket/EmojiUtil.hx similarity index 99% rename from xmpp/EmojiUtil.hx rename to snikket/EmojiUtil.hx index 9a61e53..2c86b63 100644 --- a/xmpp/EmojiUtil.hx +++ b/snikket/EmojiUtil.hx @@ -27,7 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package xmpp; +package snikket; class EmojiUtil { diff --git a/xmpp/EventEmitter.hx b/snikket/EventEmitter.hx similarity index 96% rename from xmpp/EventEmitter.hx rename to snikket/EventEmitter.hx index 7165d5c..d5e59dc 100644 --- a/xmpp/EventEmitter.hx +++ b/snikket/EventEmitter.hx @@ -1,6 +1,6 @@ -package xmpp; +package snikket; -import xmpp.EventHandler; +import snikket.EventHandler; class EventEmitter { private var eventHandlers:Map<String,Array<EventHandler>> = []; diff --git a/xmpp/EventHandler.hx b/snikket/EventHandler.hx similarity index 97% rename from xmpp/EventHandler.hx rename to snikket/EventHandler.hx index ff52e93..16f69d9 100644 --- a/xmpp/EventHandler.hx +++ b/snikket/EventHandler.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; enum EventResult { EventHandled; diff --git a/xmpp/FSM.hx b/snikket/FSM.hx similarity index 99% rename from xmpp/FSM.hx rename to snikket/FSM.hx index f6e1717..14aafd9 100644 --- a/xmpp/FSM.hx +++ b/snikket/FSM.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; import haxe.Exception; diff --git a/xmpp/GenericStream.hx b/snikket/GenericStream.hx similarity index 95% rename from xmpp/GenericStream.hx rename to snikket/GenericStream.hx index cb2cbbc..4ac545c 100644 --- a/xmpp/GenericStream.hx +++ b/snikket/GenericStream.hx @@ -1,7 +1,7 @@ -package xmpp; +package snikket; -import xmpp.Stanza; -import xmpp.EventEmitter; +import snikket.Stanza; +import snikket.EventEmitter; enum IqResult { IqResultElement(element:Stanza); diff --git a/xmpp/ID.hx b/snikket/ID.hx similarity index 96% rename from xmpp/ID.hx rename to snikket/ID.hx index 046a09f..42d29c5 100644 --- a/xmpp/ID.hx +++ b/snikket/ID.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; import hx.strings.RandomStrings; diff --git a/xmpp/Identicon.hx b/snikket/Identicon.hx similarity index 95% rename from xmpp/Identicon.hx rename to snikket/Identicon.hx index df596bf..b8d0d9e 100644 --- a/xmpp/Identicon.hx +++ b/snikket/Identicon.hx @@ -1,6 +1,6 @@ -package xmpp; +package snikket; -import xmpp.Color; +import snikket.Color; import haxe.crypto.Sha1; import haxe.io.Bytes; import haxe.io.BytesInput; diff --git a/xmpp/JID.hx b/snikket/JID.hx similarity index 99% rename from xmpp/JID.hx rename to snikket/JID.hx index 85d3146..d859e60 100644 --- a/xmpp/JID.hx +++ b/snikket/JID.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; @:expose class JID { diff --git a/xmpp/Map.js.hx b/snikket/Map.js.hx similarity index 99% rename from xmpp/Map.js.hx rename to snikket/Map.js.hx index 1f453c7..f67920d 100644 --- a/xmpp/Map.js.hx +++ b/snikket/Map.js.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; import haxe.Constraints.IMap; import js.lib.HaxeIterator; diff --git a/xmpp/Message.hx b/snikket/Message.hx similarity index 99% rename from xmpp/Message.hx rename to snikket/Message.hx index 9f45357..d943477 100644 --- a/xmpp/Message.hx +++ b/snikket/Message.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; using Lambda; diff --git a/xmpp/MessageSync.hx b/snikket/MessageSync.hx similarity index 96% rename from xmpp/MessageSync.hx rename to snikket/MessageSync.hx index a32e14e..e834268 100644 --- a/xmpp/MessageSync.hx +++ b/snikket/MessageSync.hx @@ -1,12 +1,12 @@ -package xmpp; +package snikket; import haxe.Exception; -import xmpp.Client; -import xmpp.Message; -import xmpp.GenericStream; -import xmpp.ResultSet; -import xmpp.queries.MAMQuery; +import snikket.Client; +import snikket.Message; +import snikket.GenericStream; +import snikket.ResultSet; +import snikket.queries.MAMQuery; typedef MessageList = { var sync : MessageSync; diff --git a/xmpp/Notification.hx b/snikket/Notification.hx similarity index 96% rename from xmpp/Notification.hx rename to snikket/Notification.hx index 13b0351..a7f9d01 100644 --- a/xmpp/Notification.hx +++ b/snikket/Notification.hx @@ -1,7 +1,7 @@ -package xmpp; +package snikket; -import xmpp.ChatMessage; -import xmpp.JID; +import snikket.ChatMessage; +import snikket.JID; @:expose class Notification { diff --git a/xmpp/PeerConnection.js.hx b/snikket/PeerConnection.js.hx similarity index 100% rename from xmpp/PeerConnection.js.hx rename to snikket/PeerConnection.js.hx diff --git a/xmpp/Persistence.hx b/snikket/Persistence.hx similarity index 96% rename from xmpp/Persistence.hx rename to snikket/Persistence.hx index 6a93a5a..18f9a57 100644 --- a/xmpp/Persistence.hx +++ b/snikket/Persistence.hx @@ -1,9 +1,9 @@ -package xmpp; +package snikket; import haxe.io.BytesData; -import xmpp.Chat; -import xmpp.ChatMessage; -import xmpp.Message; +import snikket.Chat; +import snikket.ChatMessage; +import snikket.Message; abstract class Persistence { abstract public function lastId(accountId: String, chatId: Null<String>, callback:(serverId:Null<String>)->Void):Void; diff --git a/xmpp/Presence.hx b/snikket/Presence.hx similarity index 92% rename from xmpp/Presence.hx rename to snikket/Presence.hx index 5ea29bb..b102850 100644 --- a/xmpp/Presence.hx +++ b/snikket/Presence.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; @:expose class Presence { diff --git a/xmpp/PubsubEvent.hx b/snikket/PubsubEvent.hx similarity index 98% rename from xmpp/PubsubEvent.hx rename to snikket/PubsubEvent.hx index 9f74f16..b5de0d3 100644 --- a/xmpp/PubsubEvent.hx +++ b/snikket/PubsubEvent.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; class PubsubEvent { private var from:Null<String>; diff --git a/xmpp/Push.hx b/snikket/Push.hx similarity index 84% rename from xmpp/Push.hx rename to snikket/Push.hx index 1f614fe..3aa7699 100644 --- a/xmpp/Push.hx +++ b/snikket/Push.hx @@ -1,10 +1,10 @@ -package xmpp; +package snikket; -import xmpp.ChatMessage; -import xmpp.JID; -import xmpp.Notification; -import xmpp.Persistence; -import xmpp.Stanza; +import snikket.ChatMessage; +import snikket.JID; +import snikket.Notification; +import snikket.Persistence; +import snikket.Stanza; // this code should expect to be called from a different context to the app diff --git a/xmpp/ReactionUpdate.hx b/snikket/ReactionUpdate.hx similarity index 98% rename from xmpp/ReactionUpdate.hx rename to snikket/ReactionUpdate.hx index 908ee49..832948e 100644 --- a/xmpp/ReactionUpdate.hx +++ b/snikket/ReactionUpdate.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; @:nullSafety(Strict) class ReactionUpdate { diff --git a/xmpp/ResultSet.hx b/snikket/ResultSet.hx similarity index 97% rename from xmpp/ResultSet.hx rename to snikket/ResultSet.hx index 19b0539..5a95481 100644 --- a/xmpp/ResultSet.hx +++ b/snikket/ResultSet.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; typedef ResultSetPageRequest = { var ?before : String; // Set to request the page before a given id (or empty string to request the very last page) diff --git a/xmpp/Stanza.hx b/snikket/Stanza.hx similarity index 99% rename from xmpp/Stanza.hx rename to snikket/Stanza.hx index a3efb96..426bc13 100644 --- a/xmpp/Stanza.hx +++ b/snikket/Stanza.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; import haxe.DynamicAccess; import haxe.Exception; diff --git a/snikket/Stream.cpp.hx b/snikket/Stream.cpp.hx new file mode 100644 index 0000000..f8b19ca --- /dev/null +++ b/snikket/Stream.cpp.hx @@ -0,0 +1,5 @@ +package snikket; + +import snikket.streams.XmppStropheStream; + +typedef Stream = snikket.streams.XmppStropheStream; diff --git a/snikket/Stream.js.hx b/snikket/Stream.js.hx new file mode 100644 index 0000000..f48d74d --- /dev/null +++ b/snikket/Stream.js.hx @@ -0,0 +1,5 @@ +package snikket; + +import snikket.streams.XmppJsStream; + +typedef Stream = snikket.streams.XmppJsStream; diff --git a/xmpp/StringUtil.hx b/snikket/StringUtil.hx similarity index 98% rename from xmpp/StringUtil.hx rename to snikket/StringUtil.hx index 808889b..030c751 100644 --- a/xmpp/StringUtil.hx +++ b/snikket/StringUtil.hx @@ -1,4 +1,4 @@ -package xmpp; +package snikket; class StringUtil { @:access(StringTools) diff --git a/xmpp/XEP0393.hx b/snikket/XEP0393.hx similarity index 98% rename from xmpp/XEP0393.hx rename to snikket/XEP0393.hx index 69974b4..ebf9133 100644 --- a/xmpp/XEP0393.hx +++ b/snikket/XEP0393.hx @@ -1,7 +1,7 @@ -package xmpp; +package snikket; -import xmpp.Autolink; -import xmpp.Stanza; +import snikket.Autolink; +import snikket.Stanza; class XEP0393 { public static function parse(styled: String) { diff --git a/xmpp/jingle/Group.hx b/snikket/jingle/Group.hx similarity index 97% rename from xmpp/jingle/Group.hx rename to snikket/jingle/Group.hx index 324e6cd..2f940fa 100644 --- a/xmpp/jingle/Group.hx +++ b/snikket/jingle/Group.hx @@ -1,4 +1,4 @@ -package xmpp.jingle; +package snikket.jingle; class Group { public var semantics (default, null): String; diff --git a/xmpp/jingle/IceServer.hx b/snikket/jingle/IceServer.hx similarity index 90% rename from xmpp/jingle/IceServer.hx rename to snikket/jingle/IceServer.hx index b372dc6..b8141a9 100644 --- a/xmpp/jingle/IceServer.hx +++ b/snikket/jingle/IceServer.hx @@ -1,4 +1,4 @@ -package xmpp.jingle; +package snikket.jingle; // from js.html.rtc but cross platform typedef IceServer = { diff --git a/xmpp/jingle/PeerConnection.cpp.hx b/snikket/jingle/PeerConnection.cpp.hx similarity index 99% rename from xmpp/jingle/PeerConnection.cpp.hx rename to snikket/jingle/PeerConnection.cpp.hx index 29fcbe6..c4c7267 100644 --- a/xmpp/jingle/PeerConnection.cpp.hx +++ b/snikket/jingle/PeerConnection.cpp.hx @@ -1,4 +1,4 @@ -package xmpp.jingle; +package snikket.jingle; typedef TODO = Dynamic; typedef MediaStreamTrack = TODO; diff --git a/xmpp/jingle/PeerConnection.js.hx b/snikket/jingle/PeerConnection.js.hx similarity index 92% rename from xmpp/jingle/PeerConnection.js.hx rename to snikket/jingle/PeerConnection.js.hx index 8d4b4b1..d9ea12d 100644 --- a/xmpp/jingle/PeerConnection.js.hx +++ b/snikket/jingle/PeerConnection.js.hx @@ -1,4 +1,4 @@ -package xmpp.jingle; +package snikket.jingle; import js.html.rtc.PeerConnection; diff --git a/xmpp/jingle/Session.hx b/snikket/jingle/Session.hx similarity index 99% rename from xmpp/jingle/Session.hx rename to snikket/jingle/Session.hx index 2cf82d7..fade99a 100644 --- a/xmpp/jingle/Session.hx +++ b/snikket/jingle/Session.hx @@ -1,8 +1,8 @@ -package xmpp.jingle; +package snikket.jingle; -import xmpp.ID; -import xmpp.jingle.PeerConnection; -import xmpp.jingle.SessionDescription; +import snikket.ID; +import snikket.jingle.PeerConnection; +import snikket.jingle.SessionDescription; using Lambda; interface Session { diff --git a/xmpp/jingle/SessionDescription.hx b/snikket/jingle/SessionDescription.hx similarity index 99% rename from xmpp/jingle/SessionDescription.hx rename to snikket/jingle/SessionDescription.hx index d7b9d56..d7f418c 100644 --- a/xmpp/jingle/SessionDescription.hx +++ b/snikket/jingle/SessionDescription.hx @@ -1,4 +1,4 @@ -package xmpp.jingle; +package snikket.jingle; import haxe.DynamicAccess; using Lambda; diff --git a/xmpp/persistence/Sqlite.hx b/snikket/persistence/Sqlite.hx similarity index 99% rename from xmpp/persistence/Sqlite.hx rename to snikket/persistence/Sqlite.hx index 3c85d7b..9d5fb31 100644 --- a/xmpp/persistence/Sqlite.hx +++ b/snikket/persistence/Sqlite.hx @@ -1,4 +1,4 @@ -package xmpp.persistence; +package snikket.persistence; #if cpp import HaxeCBridge; @@ -13,9 +13,9 @@ import haxe.io.BytesData; import sys.FileSystem; import sys.db.Connection; import sys.io.File; -import xmpp.Caps; -import xmpp.Chat; -import xmpp.Message; +import snikket.Caps; +import snikket.Chat; +import snikket.Message; // TODO: consider doing background threads for operations diff --git a/xmpp/persistence/browser.js b/snikket/persistence/browser.js similarity index 100% rename from xmpp/persistence/browser.js rename to snikket/persistence/browser.js diff --git a/xmpp/queries/DiscoInfoGet.hx b/snikket/queries/DiscoInfoGet.hx similarity index 87% rename from xmpp/queries/DiscoInfoGet.hx rename to snikket/queries/DiscoInfoGet.hx index 904aad3..b1521bc 100644 --- a/xmpp/queries/DiscoInfoGet.hx +++ b/snikket/queries/DiscoInfoGet.hx @@ -1,14 +1,14 @@ -package xmpp.queries; +package snikket.queries; import haxe.DynamicAccess; import haxe.Exception; -import xmpp.ID; -import xmpp.ResultSet; -import xmpp.Stanza; -import xmpp.Stream; -import xmpp.queries.GenericQuery; -import xmpp.Caps; +import snikket.ID; +import snikket.ResultSet; +import snikket.Stanza; +import snikket.Stream; +import snikket.queries.GenericQuery; +import snikket.Caps; class DiscoInfoGet extends GenericQuery { public var xmlns(default, null) = "http://jabber.org/protocol/disco#info"; diff --git a/xmpp/queries/DiscoItemsGet.hx b/snikket/queries/DiscoItemsGet.hx similarity index 87% rename from xmpp/queries/DiscoItemsGet.hx rename to snikket/queries/DiscoItemsGet.hx index 8738660..0c28d8f 100644 --- a/xmpp/queries/DiscoItemsGet.hx +++ b/snikket/queries/DiscoItemsGet.hx @@ -1,14 +1,14 @@ -package xmpp.queries; +package snikket.queries; import haxe.DynamicAccess; import haxe.Exception; -import xmpp.ID; -import xmpp.JID; -import xmpp.ResultSet; -import xmpp.Stanza; -import xmpp.Stream; -import xmpp.queries.GenericQuery; +import snikket.ID; +import snikket.JID; +import snikket.ResultSet; +import snikket.Stanza; +import snikket.Stream; +import snikket.queries.GenericQuery; class DiscoItemsGet extends GenericQuery { public var xmlns(default, null) = "http://jabber.org/protocol/disco#items"; diff --git a/xmpp/queries/ExtDiscoGet.hx b/snikket/queries/ExtDiscoGet.hx similarity index 83% rename from xmpp/queries/ExtDiscoGet.hx rename to snikket/queries/ExtDiscoGet.hx index 4ab5307..6a06228 100644 --- a/xmpp/queries/ExtDiscoGet.hx +++ b/snikket/queries/ExtDiscoGet.hx @@ -1,14 +1,14 @@ -package xmpp.queries; +package snikket.queries; import haxe.DynamicAccess; import haxe.Exception; -import xmpp.ID; -import xmpp.ResultSet; -import xmpp.Stanza; -import xmpp.Stream; -import xmpp.queries.GenericQuery; -import xmpp.Caps; +import snikket.ID; +import snikket.ResultSet; +import snikket.Stanza; +import snikket.Stream; +import snikket.queries.GenericQuery; +import snikket.Caps; class ExtDiscoGet extends GenericQuery { public var xmlns(default, null) = "urn:xmpp:extdisco:2"; diff --git a/xmpp/queries/GenericQuery.hx b/snikket/queries/GenericQuery.hx similarity index 92% rename from xmpp/queries/GenericQuery.hx rename to snikket/queries/GenericQuery.hx index 2139685..f32c5b1 100644 --- a/xmpp/queries/GenericQuery.hx +++ b/snikket/queries/GenericQuery.hx @@ -1,8 +1,8 @@ -package xmpp.queries; +package snikket.queries; import haxe.Exception; -import xmpp.Stanza; +import snikket.Stanza; abstract class GenericQuery { private var queryStanza:Stanza; diff --git a/xmpp/queries/HttpUploadSlot.hx b/snikket/queries/HttpUploadSlot.hx similarity index 90% rename from xmpp/queries/HttpUploadSlot.hx rename to snikket/queries/HttpUploadSlot.hx index 881a346..d755efa 100644 --- a/xmpp/queries/HttpUploadSlot.hx +++ b/snikket/queries/HttpUploadSlot.hx @@ -1,4 +1,4 @@ -package xmpp.queries; +package snikket.queries; import haxe.DynamicAccess; import haxe.Exception; @@ -6,12 +6,12 @@ import haxe.crypto.Base64; import haxe.io.Bytes; import haxe.io.BytesData; -import xmpp.ID; -import xmpp.JID; -import xmpp.ResultSet; -import xmpp.Stanza; -import xmpp.Stream; -import xmpp.queries.GenericQuery; +import snikket.ID; +import snikket.JID; +import snikket.ResultSet; +import snikket.Stanza; +import snikket.Stream; +import snikket.queries.GenericQuery; class HttpUploadSlot extends GenericQuery { public var xmlns(default, null) = "urn:xmpp:http:upload:0"; diff --git a/xmpp/queries/JabberIqGatewayGet.hx b/snikket/queries/JabberIqGatewayGet.hx similarity index 89% rename from xmpp/queries/JabberIqGatewayGet.hx rename to snikket/queries/JabberIqGatewayGet.hx index 7eb1d3f..b598633 100644 --- a/xmpp/queries/JabberIqGatewayGet.hx +++ b/snikket/queries/JabberIqGatewayGet.hx @@ -1,15 +1,15 @@ -package xmpp.queries; +package snikket.queries; import haxe.DynamicAccess; import haxe.Exception; import haxe.ds.Either; -import xmpp.ID; -import xmpp.ResultSet; -import xmpp.Stanza; -import xmpp.Stream; -import xmpp.queries.GenericQuery; -import xmpp.Caps; +import snikket.ID; +import snikket.ResultSet; +import snikket.Stanza; +import snikket.Stream; +import snikket.queries.GenericQuery; +import snikket.Caps; class JabberIqGatewayGet extends GenericQuery { public var xmlns(default, null) = "jabber:iq:gateway"; diff --git a/xmpp/queries/MAMQuery.hx b/snikket/queries/MAMQuery.hx similarity index 95% rename from xmpp/queries/MAMQuery.hx rename to snikket/queries/MAMQuery.hx index e483fe3..ffd1ef3 100644 --- a/xmpp/queries/MAMQuery.hx +++ b/snikket/queries/MAMQuery.hx @@ -1,12 +1,12 @@ -package xmpp.queries; +package snikket.queries; import haxe.Exception; -import xmpp.ID; -import xmpp.ResultSet; -import xmpp.Stanza; -import xmpp.Stream; -import xmpp.queries.GenericQuery; +import snikket.ID; +import snikket.ResultSet; +import snikket.Stanza; +import snikket.Stream; +import snikket.queries.GenericQuery; typedef MAMQueryParams = { var ?startTime : String; diff --git a/xmpp/queries/PubsubGet.hx b/snikket/queries/PubsubGet.hx similarity index 90% rename from xmpp/queries/PubsubGet.hx rename to snikket/queries/PubsubGet.hx index 0399de7..83a2cb8 100644 --- a/xmpp/queries/PubsubGet.hx +++ b/snikket/queries/PubsubGet.hx @@ -1,13 +1,13 @@ -package xmpp.queries; +package snikket.queries; import haxe.DynamicAccess; import haxe.Exception; -import xmpp.ID; -import xmpp.ResultSet; -import xmpp.Stanza; -import xmpp.Stream; -import xmpp.queries.GenericQuery; +import snikket.ID; +import snikket.ResultSet; +import snikket.Stanza; +import snikket.Stream; +import snikket.queries.GenericQuery; class PubsubGet extends GenericQuery { public var xmlns(default, null) = "http://jabber.org/protocol/pubsub"; diff --git a/xmpp/queries/Push2Enable.hx b/snikket/queries/Push2Enable.hx similarity index 93% rename from xmpp/queries/Push2Enable.hx rename to snikket/queries/Push2Enable.hx index e27c4f0..5b4df2c 100644 --- a/xmpp/queries/Push2Enable.hx +++ b/snikket/queries/Push2Enable.hx @@ -1,11 +1,11 @@ -package xmpp.queries; +package snikket.queries; import haxe.io.Bytes; import haxe.crypto.Base64; -import xmpp.ID; -import xmpp.Stanza; -import xmpp.queries.GenericQuery; +import snikket.ID; +import snikket.Stanza; +import snikket.queries.GenericQuery; class Push2Enable extends GenericQuery { public var xmlns(default, null) = "urn:xmpp:push2:0"; diff --git a/xmpp/queries/RosterGet.hx b/snikket/queries/RosterGet.hx similarity index 88% rename from xmpp/queries/RosterGet.hx rename to snikket/queries/RosterGet.hx index 469e9d0..7bcabdd 100644 --- a/xmpp/queries/RosterGet.hx +++ b/snikket/queries/RosterGet.hx @@ -1,13 +1,13 @@ -package xmpp.queries; +package snikket.queries; import haxe.DynamicAccess; import haxe.Exception; -import xmpp.ID; -import xmpp.ResultSet; -import xmpp.Stanza; -import xmpp.Stream; -import xmpp.queries.GenericQuery; +import snikket.ID; +import snikket.ResultSet; +import snikket.Stanza; +import snikket.Stream; +import snikket.queries.GenericQuery; class RosterGet extends GenericQuery { public var xmlns(default, null) = "jabber:iq:roster"; diff --git a/xmpp/queries/VcardTempGet.hx b/snikket/queries/VcardTempGet.hx similarity index 88% rename from xmpp/queries/VcardTempGet.hx rename to snikket/queries/VcardTempGet.hx index ed8df0c..736ab35 100644 --- a/xmpp/queries/VcardTempGet.hx +++ b/snikket/queries/VcardTempGet.hx @@ -1,15 +1,15 @@ -package xmpp.queries; +package snikket.queries; import haxe.DynamicAccess; import haxe.Exception; import haxe.crypto.Base64; import haxe.io.Bytes; -import xmpp.ID; -import xmpp.ResultSet; -import xmpp.Stanza; -import xmpp.Stream; -import xmpp.queries.GenericQuery; +import snikket.ID; +import snikket.ResultSet; +import snikket.Stanza; +import snikket.Stream; +import snikket.queries.GenericQuery; class VcardTempGet extends GenericQuery { public var xmlns(default, null) = "vcard-temp"; diff --git a/xmpp/streams/XmppJsStream.hx b/snikket/streams/XmppJsStream.hx similarity index 98% rename from xmpp/streams/XmppJsStream.hx rename to snikket/streams/XmppJsStream.hx index e1cc8de..d052293 100644 --- a/xmpp/streams/XmppJsStream.hx +++ b/snikket/streams/XmppJsStream.hx @@ -1,13 +1,13 @@ -package xmpp.streams; +package snikket.streams; import js.lib.Promise; import haxe.Http; import haxe.Json; using Lambda; -import xmpp.FSM; -import xmpp.GenericStream; -import xmpp.Stanza; +import snikket.FSM; +import snikket.GenericStream; +import snikket.Stanza; @:jsRequire("@xmpp/sasl-scram-sha-1") extern class XmppJsScramSha1 { diff --git a/xmpp/streams/XmppStropheStream.hx b/snikket/streams/XmppStropheStream.hx similarity index 99% rename from xmpp/streams/XmppStropheStream.hx rename to snikket/streams/XmppStropheStream.hx index 1126dd7..0ae68b7 100644 --- a/xmpp/streams/XmppStropheStream.hx +++ b/snikket/streams/XmppStropheStream.hx @@ -1,4 +1,4 @@ -package xmpp.streams; +package snikket.streams; import haxe.DynamicAccess; @@ -11,9 +11,9 @@ import cpp.NativeString; import cpp.RawConstPointer; import cpp.RawPointer; -import xmpp.GenericStream; -import xmpp.ID; -import xmpp.Stanza; +import snikket.GenericStream; +import snikket.ID; +import snikket.Stanza; @:include("strophe.h") @:native("xmpp_mem_t*") diff --git a/xmpp/Stream.cpp.hx b/xmpp/Stream.cpp.hx deleted file mode 100644 index f864419..0000000 --- a/xmpp/Stream.cpp.hx +++ /dev/null @@ -1,5 +0,0 @@ -package xmpp; - -import xmpp.streams.XmppStropheStream; - -typedef Stream = xmpp.streams.XmppStropheStream; diff --git a/xmpp/Stream.js.hx b/xmpp/Stream.js.hx deleted file mode 100644 index 5c36c25..0000000 --- a/xmpp/Stream.js.hx +++ /dev/null @@ -1,5 +0,0 @@ -package xmpp; - -import xmpp.streams.XmppJsStream; - -typedef Stream = xmpp.streams.XmppJsStream;