Overview
Comment: | Coding style. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
bf1be4f266b857c1617f970f3df0a7f4 |
User & Date: | js on 2013-07-01 20:33:49 |
Other Links: | manifest | tags |
Context
2013-07-01
| ||
20:49 | Update buildsys. check-in: 63dbedd5a9 user: js tags: trunk | |
20:33 | Coding style. check-in: bf1be4f266 user: js tags: trunk | |
20:07 | Fix argument checking for XMPPDiscoEntity check-in: 4d52c6bfc6 user: florob@babelmonkeys.de tags: trunk | |
Changes
Modified src/XMPPCallback.m from [629a5d1a6d] to [795bea9efd].
︙ | ︙ | |||
51 52 53 54 55 56 57 | + (instancetype)callbackWithTarget: (id)target selector: (SEL)selector { return [[[self alloc] initWithTarget: target selector: selector] autorelease]; } | | | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | + (instancetype)callbackWithTarget: (id)target selector: (SEL)selector { return [[[self alloc] initWithTarget: target selector: selector] autorelease]; } - initWithTarget: (id)target selector: (SEL)selector { self = [super init]; _target = [target retain]; _selector = selector; return self; } - (void)dealloc { [_target release]; |
︙ | ︙ |
Modified src/XMPPConnection.m from [0f3d82c9ea] to [150ec0f157].
︙ | ︙ | |||
56 57 58 59 60 61 62 | #import <ObjFW/macros.h> #define BUFFER_LENGTH 512 @interface XMPPConnection_ConnectThread: OFThread { | | | | | | | | | | | | | 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 | #import <ObjFW/macros.h> #define BUFFER_LENGTH 512 @interface XMPPConnection_ConnectThread: OFThread { OFThread *_sourceThread; XMPPConnection *_connection; } - initWithSourceThread: (OFThread*)sourceThread connection: (XMPPConnection*)connection; @end @implementation XMPPConnection_ConnectThread - initWithSourceThread: (OFThread*)sourceThread connection: (XMPPConnection*)connection { self = [super init]; @try { _sourceThread = [sourceThread retain]; _connection = [connection retain]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_sourceThread release]; [_connection release]; [super dealloc]; } - (void)didConnect { [self join]; [_connection handleConnection]; } - (id)main { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [_connection connect]; [self performSelector: @selector(didConnect) onThread: _sourceThread waitUntilDone: false]; [pool release]; return nil; } @end |
︙ | ︙ | |||
233 234 235 236 237 238 239 | } - (OFString*)server { return [[_server copy] autorelease]; } | | | | | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | } - (OFString*)server { return [[_server copy] autorelease]; } - (void)setDomain: (OFString*)domain { OFString *oldDomain = _domain; OFString *oldDomainToASCII = _domainToASCII; if (domain != nil) { char *srv; Stringprep_rc rc; if ((rc = stringprep_profile([domain UTF8String], &srv, "Nameprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException exceptionWithConnection: self profile: @"Nameprep" string: domain]; @try { _domain = [[OFString alloc] initWithUTF8String: srv]; } @finally { free(srv); } |
︙ | ︙ | |||
1197 1198 1199 1200 1201 1202 1203 | assert(0); [_delegates broadcastSelector: @selector(connection:wasBoundToJID:) withObject: self withObject: _JID]; } | | | | | 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | assert(0); [_delegates broadcastSelector: @selector(connection:wasBoundToJID:) withObject: self withObject: _JID]; } - (OFString*)XMPP_IDNAToASCII: (OFString*)domain { OFString *ret; char *cDomain; Idna_rc rc; if ((rc = idna_to_ascii_8z([domain UTF8String], &cDomain, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS) @throw [XMPPIDNATranslationFailedException exceptionWithConnection: self operation: @"ToASCII" string: domain]; @try { ret = [[OFString alloc] initWithUTF8String: cDomain]; } @finally { free(cDomain); } |
︙ | ︙ |
Modified src/XMPPContactManager.m from [9764686bc1] to [ca133d05bd].
︙ | ︙ | |||
24 25 26 27 28 29 30 | #import "XMPPContactManager.h" #import "XMPPJID.h" #import "XMPPMulticastDelegate.h" #import "XMPPPresence.h" #import "XMPPRosterItem.h" @implementation XMPPContactManager | | | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #import "XMPPContactManager.h" #import "XMPPJID.h" #import "XMPPMulticastDelegate.h" #import "XMPPPresence.h" #import "XMPPRosterItem.h" @implementation XMPPContactManager - initWithConnection: (XMPPConnection*)connection roster: (XMPPRoster*)roster { self = [super init]; @try { _connection = connection; [_connection addDelegate: self]; _roster = roster; [_roster addDelegate: self]; _contacts = [[OFMutableDictionary alloc] init]; _delegates = [[XMPPMulticastDelegate alloc] init]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
85 86 87 88 89 90 91 | } - (OFDictionary*)contacts { OF_GETTER(_contacts, true) } | | | | | 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 | } - (OFDictionary*)contacts { OF_GETTER(_contacts, true) } - (void)rosterWasReceived: (XMPPRoster*)roster { OFEnumerator *contactEnumerator; XMPPContact *contact; OFDictionary *rosterItems; OFEnumerator *rosterItemEnumerator; OFString *bareJID; contactEnumerator = [_contacts objectEnumerator]; while ((contact = [contactEnumerator nextObject]) != nil) { [_delegates broadcastSelector: @selector(contactManager: didRemoveContact:) withObject: self withObject: contact]; } [_contacts release]; _contacts = [[OFMutableDictionary alloc] init]; rosterItems = [roster rosterItems]; rosterItemEnumerator = [rosterItems keyEnumerator]; while ((bareJID = [rosterItemEnumerator nextObject]) != nil) { contact = [[[XMPPContact alloc] init] autorelease]; [contact XMPP_setRosterItem: [rosterItems objectForKey: bareJID]]; [_contacts setObject: contact forKey: bareJID]; [_delegates broadcastSelector: @selector(contactManager: didAddContact:) withObject: self |
︙ | ︙ | |||
137 138 139 140 141 142 143 | withObject: self withObject: contact]; [_contacts removeObjectForKey: bareJID]; return; } if (contact == nil) { | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | withObject: self withObject: contact]; [_contacts removeObjectForKey: bareJID]; return; } if (contact == nil) { contact = [[[XMPPContact alloc] init] autorelease]; [contact XMPP_setRosterItem: rosterItem]; [_contacts setObject: contact forKey: bareJID]; [_delegates broadcastSelector: @selector(contactManager: didAddContact:) withObject: self withObject: contact]; |
︙ | ︙ |
Modified src/XMPPDiscoEntity.m from [0b97adbd3d] to [6081227565].
︙ | ︙ | |||
47 48 49 50 51 52 53 | - initWithConnection: (XMPPConnection*)connection capsNode: (OFString*)capsNode { self = [super initWithJID: [connection JID] node: nil]; @try { | | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - initWithConnection: (XMPPConnection*)connection capsNode: (OFString*)capsNode { self = [super initWithJID: [connection JID] node: nil]; @try { _discoNodes = [[OFMutableDictionary alloc] init]; _connection = connection; _capsNode = [capsNode copy]; [_connection addDelegate: self]; } @catch (id e) { [self release]; @throw e; |
︙ | ︙ |
Modified src/XMPPDiscoNode.m from [b7adfdbf3f] to [898738e772].
︙ | ︙ | |||
57 58 59 60 61 62 63 | - initWithJID: (XMPPJID*)JID node: (OFString*)node name: (OFString*)name { self = [super init]; @try { | | | | | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | - initWithJID: (XMPPJID*)JID node: (OFString*)node name: (OFString*)name { self = [super init]; @try { if (JID == nil && ![self isKindOfClass: [XMPPDiscoEntity class]]) @throw [OFInvalidArgumentException exception]; _JID = [JID copy]; _node = [node copy]; _name = [name copy]; _identities = [[OFSortedList alloc] init]; _features = [[OFSortedList alloc] init]; _childNodes = [[OFMutableDictionary alloc] init]; [self addFeature: XMPP_NS_DISCO_ITEMS]; [self addFeature: XMPP_NS_DISCO_INFO]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ |
Modified src/XMPPFileStorage.m from [b9ae4e6e80] to [16569f778a].
︙ | ︙ | |||
51 52 53 54 55 56 57 | } - initWithFile: (OFString*)file { self = [super init]; @try { | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | } - initWithFile: (OFString*)file { self = [super init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; _file = [file copy]; @try { _data = [[[OFDataArray dataArrayWithContentsOfFile: file] messagePackValue] retain]; } @catch (id e) { _data = [[OFMutableDictionary alloc] init]; } [pool release]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
130 131 132 133 134 135 136 | return object; } - (void)setStringValue: (OFString*)string forPath: (OFString*)path { | | | | | | | | | | | | 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 243 244 245 246 247 248 | return object; } - (void)setStringValue: (OFString*)string forPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [self XMPP_setObject: string forPath: path]; [pool release]; } - (OFString*)stringValueForPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *string; string = [self XMPP_objectForPath: path]; [pool release]; return string; } - (void)setBooleanValue: (bool)boolean forPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [self XMPP_setObject: [OFNumber numberWithBool: boolean] forPath: path]; [pool release]; } - (bool)booleanValueForPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; bool boolean; boolean = [[self XMPP_objectForPath: path] boolValue]; [pool release]; return boolean; } - (void)setIntegerValue: (intmax_t)integer forPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [self XMPP_setObject: [OFNumber numberWithIntMax: integer] forPath: path]; [pool release]; } - (intmax_t)integerValueForPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; intmax_t integer; integer = [[self XMPP_objectForPath: path] intMaxValue]; [pool release]; return integer; } - (void)setArray: (OFArray*)array forPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [self XMPP_setObject: array forPath: path]; [pool release]; } - (OFArray*)arrayForPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFArray *array; array = [self XMPP_objectForPath: path]; [pool release]; return array; } - (void)setDictionary: (OFDictionary*)dictionary forPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [self XMPP_setObject: dictionary forPath: path]; [pool release]; } - (OFDictionary*)dictionaryForPath: (OFString*)path { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFDictionary *dictionary; dictionary = [self XMPP_objectForPath: path]; [pool release]; return dictionary; } @end |
Modified src/XMPPIQ.m from [53dae4baf4] to [6ae171823d].
︙ | ︙ | |||
60 61 62 63 64 65 66 | XMPPIQ *ret = [XMPPIQ IQWithType: @"result" ID: [self ID]]; [ret setTo: [self from]]; [ret setFrom: nil]; return ret; } | | | | | | 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 | XMPPIQ *ret = [XMPPIQ IQWithType: @"result" ID: [self ID]]; [ret setTo: [self from]]; [ret setFrom: nil]; return ret; } - (XMPPIQ*)errorIQWithType: (OFString*)type condition: (OFString*)condition text: (OFString*)text { XMPPIQ *ret = [XMPPIQ IQWithType: @"error" ID: [self ID]]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFXMLElement *error = [OFXMLElement elementWithName: @"error" namespace: XMPP_NS_CLIENT]; [error addAttributeWithName: @"type" stringValue: type]; [error addChild: [OFXMLElement elementWithName: condition namespace: XMPP_NS_STANZAS]]; if (text) [error addChild: [OFXMLElement elementWithName: @"text" namespace: XMPP_NS_STANZAS stringValue: text]]; [ret addChild: error]; [ret setTo: [self from]]; [ret setFrom: nil]; [pool release]; return ret; } - (XMPPIQ*)errorIQWithType: (OFString*)type condition: (OFString*)condition { return [self errorIQWithType: type condition: condition text: nil]; } @end |
Modified src/XMPPRoster.m from [3142167b8a] to [e703f5f457].
︙ | ︙ | |||
36 37 38 39 40 41 42 | #import "XMPPConnection.h" #import "XMPPIQ.h" #import "XMPPJID.h" #import "XMPPMulticastDelegate.h" #import "namespaces.h" @implementation XMPPRoster | | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #import "XMPPConnection.h" #import "XMPPIQ.h" #import "XMPPJID.h" #import "XMPPMulticastDelegate.h" #import "namespaces.h" @implementation XMPPRoster - initWithConnection: (XMPPConnection*)connection { self = [super init]; @try { _rosterItems = [[OFMutableDictionary alloc] init]; _connection = connection; [_connection addDelegate: self]; _delegates = [[XMPPMulticastDelegate alloc] init]; _dataStorage = [_connection dataStorage]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
351 352 353 354 355 356 357 | OFAutoreleasePool *pool; XMPPRosterItem *rosterItem; if (![[element name] isEqual: @"item"] || ![[element namespace] isEqual: XMPP_NS_ROSTER]) continue; | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | OFAutoreleasePool *pool; XMPPRosterItem *rosterItem; if (![[element name] isEqual: @"item"] || ![[element namespace] isEqual: XMPP_NS_ROSTER]) continue; pool = [[OFAutoreleasePool alloc] init]; rosterItem = [self XMPP_rosterItemWithXMLElement: element]; [self XMPP_updateRosterItem: rosterItem]; [pool release]; } if ([connection supportsRosterVersioning] && rosterElement != nil) { |
︙ | ︙ |
Modified src/XMPPSCRAMAuth.h from [5736a7576b] to [6f2119f050].
︙ | ︙ | |||
110 111 112 113 114 115 116 | hash: (Class)hash plusAvailable: (bool)plusAvailable; /// \cond internal - (OFString*)XMPP_genNonce; - (uint8_t*)XMPP_HMACWithKey: (OFDataArray*)key data: (OFDataArray*)data; | | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | hash: (Class)hash plusAvailable: (bool)plusAvailable; /// \cond internal - (OFString*)XMPP_genNonce; - (uint8_t*)XMPP_HMACWithKey: (OFDataArray*)key data: (OFDataArray*)data; - (OFDataArray*)XMPP_hiWithData: (OFDataArray*)str salt: (OFDataArray*)salt iterationCount: (intmax_t)i; - (OFDataArray*)XMPP_parseServerFirstMessage: (OFDataArray*)data; - (OFDataArray*)XMPP_parseServerFinalMessage: (OFDataArray*)data; /// \endcond @end |
Modified src/XMPPSCRAMAuth.m from [2dea2d70da] to [b4f3994709].
︙ | ︙ | |||
470 471 472 473 474 475 476 | [hashO retain]; [pool release]; return [[hashO autorelease] digest]; } | | | | | | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | [hashO retain]; [pool release]; return [[hashO autorelease] digest]; } - (OFDataArray*)XMPP_hiWithData: (OFDataArray*)str salt: (OFDataArray*)salt iterationCount: (intmax_t)i { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; size_t digestSize = [_hashType digestSize]; uint8_t *result = NULL, *u, *uOld; intmax_t j, k; OFDataArray *salty, *tmp, *ret; result = [self allocMemoryWithSize: digestSize]; @try { memset(result, 0, digestSize); salty = [[salt copy] autorelease]; [salty addItems: "\0\0\0\1" count: 4]; uOld = [self XMPP_HMACWithKey: str data: salty]; for (j = 0; j < digestSize; j++) result[j] ^= uOld[j]; for (j = 0; j < i - 1; j++) { tmp = [[OFDataArray alloc] init]; [tmp addItems: uOld count: digestSize]; [pool releaseObjects]; // releases uOld and previous tmp [tmp autorelease]; u = [self XMPP_HMACWithKey: str |
︙ | ︙ |