Overview
Comment: | Rename XMPPJSONFileStorage to XMPPFileStorage.
It uses BinaryPack instead of JSON now. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c9bb52e8239a7748bb46fcbde137df14 |
User & Date: | js on 2013-02-23 13:49:32 |
Other Links: | manifest | tags |
Context
2013-03-03
| ||
16:30 | Fix up -[XMPPJID isEqual:] and -[XMPPJID hash] check-in: 8bc32c2743 user: florob@babelmonkeys.de tags: trunk | |
2013-02-23
| ||
13:49 | Rename XMPPJSONFileStorage to XMPPFileStorage. check-in: c9bb52e823 user: js tags: trunk | |
2013-02-18
| ||
23:16 | Adjust to recent ObjFW changes. check-in: e81a369270 user: js tags: trunk | |
Changes
Modified .gitignore from [2fa598a929] to [25d2864b5c].
︙ | ︙ | |||
15 16 17 18 19 20 21 | docs extra.mk ObjXMPP.xcodeproj/*.mode1v3 ObjXMPP.xcodeproj/*.pbxuser ObjXMPP.xcodeproj/project.xcworkspace ObjXMPP.xcodeproj/xcuserdata tests/tests | > | 15 16 17 18 19 20 21 22 | docs extra.mk ObjXMPP.xcodeproj/*.mode1v3 ObjXMPP.xcodeproj/*.pbxuser ObjXMPP.xcodeproj/project.xcworkspace ObjXMPP.xcodeproj/xcuserdata tests/tests tests/storage.binarypack |
Modified src/Makefile from [0633fdc12c] to [ad510f6243].
︙ | ︙ | |||
10 11 12 13 14 15 16 | XMPPConnection.m \ XMPPContact.m \ XMPPContactManager.m \ XMPPExceptions.m \ XMPPEXTERNALAuth.m \ XMPPIQ.m \ XMPPJID.m \ | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | XMPPConnection.m \ XMPPContact.m \ XMPPContactManager.m \ XMPPExceptions.m \ XMPPEXTERNALAuth.m \ XMPPIQ.m \ XMPPJID.m \ XMPPFileStorage.m \ XMPPMessage.m \ XMPPMulticastDelegate.m \ XMPPPLAINAuth.m \ XMPPPresence.m \ XMPPRoster.m \ XMPPRosterItem.m \ XMPPSCRAMAuth.m \ |
︙ | ︙ |
Added src/XMPPFileStorage.h version [add2d8e5da].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /* * Copyright (c) 2012, Jonathan Schleifer <js@webkeks.org> * * https://webkeks.org/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #import <ObjFW/OFObject.h> #import "XMPPStorage.h" @class OFMutableDictionary; @interface XMPPFileStorage: OFObject <XMPPStorage> { OFString *_file; OFMutableDictionary *_data; } - initWithFile: (OFString*)file; @end |
Added src/XMPPFileStorage.m version [b5f01ad0ba].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | /* * Copyright (c) 2012, Jonathan Schleifer <js@webkeks.org> * * https://webkeks.org/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #import <ObjFW/OFString.h> #import <ObjFW/OFArray.h> #import <ObjFW/OFDictionary.h> #import <ObjFW/OFNumber.h> #import <ObjFW/OFDataArray.h> #import <ObjFW/OFAutoreleasePool.h> #import <ObjFW/OFNotImplementedException.h> #import "XMPPFileStorage.h" @implementation XMPPFileStorage - init { Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; } - initWithFile: (OFString*)file { self = [super init]; @try { OFAutoreleasePool *pool = [OFAutoreleasePool new]; _file = [file copy]; @try { _data = [[[OFDataArray dataArrayWithContentsOfFile: file] binaryPackValue] retain]; } @catch (id e) { _data = [OFMutableDictionary new]; } [pool release]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_file release]; [_data release]; [super dealloc]; } - (void)save { [[_data binaryPackRepresentation] writeToFile: _file]; } - (void)XMPP_setObject: (id)object forPath: (OFString*)path { OFArray *pathComponents = [path componentsSeparatedByString: @"."]; OFMutableDictionary *iter = _data; OFEnumerator *enumerator = [pathComponents objectEnumerator]; OFString *component; size_t i = 0, components = [pathComponents count]; while ((component = [enumerator nextObject]) != nil) { if (i++ == components - 1) continue; OFMutableDictionary *iter2 = [iter objectForKey: component]; if (iter2 == nil) { iter2 = [OFMutableDictionary dictionary]; [iter setObject: iter2 forKey: component]; } iter = iter2; } if (object != nil) [iter setObject: object forKey: [pathComponents lastObject]]; else [iter removeObjectForKey: [pathComponents lastObject]]; } - (id)XMPP_objectForPath: (OFString*)path { OFArray *pathComponents = [path componentsSeparatedByString: @"."]; OFEnumerator *enumerator = [pathComponents objectEnumerator]; OFString *component; id object = _data; while ((component = [enumerator nextObject]) != nil) object = [object objectForKey: component]; return object; } - (void)setStringValue: (OFString*)string forPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; [self XMPP_setObject: string forPath: path]; [pool release]; } - (OFString*)stringValueForPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; OFString *string; string = [self XMPP_objectForPath: path]; [pool release]; return string; } - (void)setBooleanValue: (BOOL)boolean forPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; [self XMPP_setObject: [OFNumber numberWithBool: boolean] forPath: path]; [pool release]; } - (BOOL)booleanValueForPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; BOOL boolean; boolean = [[self XMPP_objectForPath: path] boolValue]; [pool release]; return boolean; } - (void)setIntegerValue: (intmax_t)integer forPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; [self XMPP_setObject: [OFNumber numberWithIntMax: integer] forPath: path]; [pool release]; } - (intmax_t)integerValueForPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; intmax_t integer; integer = [[self XMPP_objectForPath: path] intMaxValue]; [pool release]; return integer; } - (void)setArray: (OFArray*)array forPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; [self XMPP_setObject: array forPath: path]; [pool release]; } - (OFArray*)arrayForPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; OFArray *array; array = [self XMPP_objectForPath: path]; [pool release]; return array; } - (void)setDictionary: (OFDictionary*)dictionary forPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; [self XMPP_setObject: dictionary forPath: path]; [pool release]; } - (OFDictionary*)dictionaryForPath: (OFString*)path { OFAutoreleasePool *pool = [OFAutoreleasePool new]; OFDictionary *dictionary; dictionary = [self XMPP_objectForPath: path]; [pool release]; return dictionary; } @end |
Deleted src/XMPPJSONFileStorage.h version [5505b46086].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted src/XMPPJSONFileStorage.m version [0ded529f90].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified src/XMPPRoster.m from [025bb21619] to [1fa0d01ca6].
︙ | ︙ | |||
301 302 303 304 305 306 307 | if ([groups count] > 0) [rosterItem setGroups: groups]; return rosterItem; } | | | | | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | if ([groups count] > 0) [rosterItem setGroups: groups]; return rosterItem; } - (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection IQ: (XMPPIQ*)IQ { OFXMLElement *rosterElement; OFEnumerator *enumerator; OFXMLElement *element; rosterElement = [IQ elementForName: @"query" namespace: XMPP_NS_ROSTER]; if ([connection supportsRosterVersioning]) { if (rosterElement == nil) { OFDictionary *items = [_dataStorage dictionaryForPath: @"roster.items"]; OFEnumerator *enumerator = [items objectEnumerator]; OFDictionary *item; while ((item = [enumerator nextObject]) != nil) { |
︙ | ︙ | |||
357 358 359 360 361 362 363 | pool = [OFAutoreleasePool new]; rosterItem = [self XMPP_rosterItemWithXMLElement: element]; [self XMPP_updateRosterItem: rosterItem]; [pool release]; } | | | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | pool = [OFAutoreleasePool new]; rosterItem = [self XMPP_rosterItemWithXMLElement: element]; [self XMPP_updateRosterItem: rosterItem]; [pool release]; } if ([connection supportsRosterVersioning] && rosterElement != nil) { OFString *ver = [[rosterElement attributeForName: @"ver"] stringValue]; [_dataStorage setStringValue: ver forPath: @"roster.ver"]; [_dataStorage save]; } [_delegates broadcastSelector: @selector(rosterWasReceived:) withObject: self]; } @end |
Modified tests/test.m from [1cf3c54e24] to [ef9f547a18].
︙ | ︙ | |||
29 30 31 32 33 34 35 | #import "XMPPJID.h" #import "XMPPStanza.h" #import "XMPPIQ.h" #import "XMPPMessage.h" #import "XMPPPresence.h" #import "XMPPRoster.h" #import "XMPPStreamManagement.h" | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #import "XMPPJID.h" #import "XMPPStanza.h" #import "XMPPIQ.h" #import "XMPPMessage.h" #import "XMPPPresence.h" #import "XMPPRoster.h" #import "XMPPStreamManagement.h" #import "XMPPFileStorage.h" @interface AppDelegate: OFObject #ifdef OF_HAVE_OPTIONAL_PROTOCOLS <OFApplicationDelegate, XMPPConnectionDelegate, XMPPRosterDelegate> #endif { XMPPConnection *conn; |
︙ | ︙ | |||
103 104 105 106 107 108 109 | [[stanza from] fullJID], [[stanza to] fullJID], [stanza type], [stanza ID]] isEqual: @"bob@localhost, alice@localhost, get, 42"])); conn = [[XMPPConnection alloc] init]; [conn addDelegate: self]; | | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | [[stanza from] fullJID], [[stanza to] fullJID], [stanza type], [stanza ID]] isEqual: @"bob@localhost, alice@localhost, get, 42"])); conn = [[XMPPConnection alloc] init]; [conn addDelegate: self]; XMPPFileStorage *storage = [[XMPPFileStorage alloc] initWithFile: @"storage.binarypack"]; [conn setDataStorage: storage]; roster = [[XMPPRoster alloc] initWithConnection: conn]; [roster addDelegate: self]; [[XMPPStreamManagement alloc] initWithConnection: conn]; |
︙ | ︙ |