-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d422e28
commit 9bc1b16
Showing
33 changed files
with
1,969 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
Extensions/XEP-0045/CoreDataStorage/XMPPRoom.xcdatamodeld/.xccurrentversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>_XCCurrentVersionName</key> | ||
<string>XMPPRoom.xcdatamodel</string> | ||
</dict> | ||
</plist> |
35 changes: 35 additions & 0 deletions
35
Extensions/XEP-0045/CoreDataStorage/XMPPRoom.xcdatamodeld/XMPPRoom.xcdatamodel/contents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="875" systemVersion="11C74" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic"> | ||
<entity name="XMPPRoomMessageCoreDataStorageObject" representedClassName="XMPPRoomMessageCoreDataStorageObject" syncable="YES"> | ||
<attribute name="body" optional="YES" attributeType="String" indexed="YES" syncable="YES"/> | ||
<attribute name="fromMe" attributeType="Boolean" defaultValueString="NO" syncable="YES"/> | ||
<attribute name="jid" optional="YES" transient="YES" syncable="YES"/> | ||
<attribute name="jidStr" optional="YES" attributeType="String" syncable="YES"/> | ||
<attribute name="localTimestamp" attributeType="Date" indexed="YES" syncable="YES"/> | ||
<attribute name="message" optional="YES" transient="YES" syncable="YES"/> | ||
<attribute name="messageStr" optional="YES" attributeType="String" syncable="YES"/> | ||
<attribute name="nickname" optional="YES" attributeType="String" syncable="YES"/> | ||
<attribute name="remoteTimestamp" optional="YES" attributeType="Date" indexed="YES" syncable="YES"/> | ||
<attribute name="roomJID" optional="YES" transient="YES" syncable="YES"/> | ||
<attribute name="roomJIDStr" attributeType="String" indexed="YES" syncable="YES"/> | ||
<attribute name="streamBareJidStr" attributeType="String" indexed="YES" syncable="YES"/> | ||
</entity> | ||
<entity name="XMPPRoomOccupantCoreDataStorageObject" representedClassName="XMPPRoomOccupantCoreDataStorageObject" syncable="YES"> | ||
<attribute name="affiliation" optional="YES" attributeType="String" syncable="YES"/> | ||
<attribute name="jid" optional="YES" transient="YES" syncable="YES"/> | ||
<attribute name="jidStr" attributeType="String" indexed="YES" syncable="YES"/> | ||
<attribute name="nickname" optional="YES" attributeType="String" indexed="YES" syncable="YES"/> | ||
<attribute name="presence" optional="YES" transient="YES" syncable="YES"/> | ||
<attribute name="presenceStr" optional="YES" attributeType="String" syncable="YES"/> | ||
<attribute name="realJID" optional="YES" transient="YES" syncable="YES"/> | ||
<attribute name="realJIDStr" optional="YES" attributeType="String" syncable="YES"/> | ||
<attribute name="role" optional="YES" attributeType="String" syncable="YES"/> | ||
<attribute name="roomJID" optional="YES" transient="YES" syncable="YES"/> | ||
<attribute name="roomJIDStr" attributeType="String" indexed="YES" syncable="YES"/> | ||
<attribute name="streamBareJidStr" attributeType="String" indexed="YES" syncable="YES"/> | ||
</entity> | ||
<elements> | ||
<element name="XMPPRoomMessageCoreDataStorageObject" positionX="160" positionY="192" width="128" height="225"/> | ||
<element name="XMPPRoomOccupantCoreDataStorageObject" positionX="160" positionY="192" width="128" height="225"/> | ||
</elements> | ||
</model> |
84 changes: 84 additions & 0 deletions
84
Extensions/XEP-0045/CoreDataStorage/XMPPRoomCoreDataStorage.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <CoreData/CoreData.h> | ||
|
||
#import "XMPP.h" | ||
#import "XMPPRoom.h" | ||
#import "XMPPRoomMessageCoreDataStorageObject.h" | ||
#import "XMPPRoomOccupantCoreDataStorageObject.h" | ||
#import "XMPPCoreDataStorage.h" | ||
|
||
|
||
@interface XMPPRoomCoreDataStorage : XMPPCoreDataStorage <XMPPRoomStorage> | ||
|
||
/** | ||
* Convenience method to get an instance with the default database name. | ||
* | ||
* IMPORTANT: | ||
* You are NOT required to use the sharedInstance. | ||
* | ||
* If your application makes extensive use of MUC, and you use a sharedInstance of this class, | ||
* then all of your MUC rooms share the same database store. You might get better performance if you create | ||
* multiple instances of this class instead (using different database filenames), as this way you can have | ||
* concurrent writes to multiple databases. | ||
**/ | ||
+ (XMPPRoomCoreDataStorage *)sharedInstance; | ||
|
||
|
||
/* Inherited from XMPPCoreDataStorage | ||
* Please see the XMPPCoreDataStorage header file for extensive documentation. | ||
- (id)initWithDatabaseFilename:(NSString *)databaseFileName; | ||
- (id)initWithInMemoryStore; | ||
@property (readonly) NSString *databaseFileName; | ||
@property (readwrite) NSUInteger saveThreshold; | ||
@property (readonly) NSManagedObjectModel *managedObjectModel; | ||
@property (readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator; | ||
*/ | ||
|
||
/** | ||
* It is likely you don't want the message history to persist forever. | ||
* Doing so would allow the database to grow infinitely large over time. | ||
* | ||
* The maxMessageAge property provides a way to specify how old a message can get | ||
* before it should get deleted from the database. | ||
* | ||
* The deleteInterval specifies how often to sweep for old messages. | ||
* Since deleting is an expensive operation (disk io) it is done on a fixed interval. | ||
* | ||
* You can optionally disable the maxMessageAge by setting it to zero (or a negative value). | ||
* If you disable the maxMessageAge then old messages are not deleted. | ||
* | ||
* You can optionally disable the deleteInterval by setting it to zero (or a negative value). | ||
* | ||
* The default maxAge is 7 days. | ||
* The default deleteInterval is 5 minutes. | ||
**/ | ||
@property (assign, readwrite) NSTimeInterval maxMessageAge; | ||
@property (assign, readwrite) NSTimeInterval deleteInterval; | ||
|
||
/** | ||
* You may optionally prevent old message deletion for particular rooms. | ||
**/ | ||
- (void)pauseOldMessageDeletionForRoom:(XMPPJID *)roomJID; | ||
- (void)resumeOldMessageDeletionForRoom:(XMPPJID *)roomJID; | ||
|
||
/** | ||
* Returns the timestamp of the most recent message stored in the database for the given room. | ||
* This may be used when requesting the message history from the server, | ||
* to prevent redownloading messages you already have. | ||
* | ||
* Keep in mind that the | ||
**/ | ||
- (NSDate *)mostRecentMessageTimestampForRoom:(XMPPJID *)roomJID; | ||
- (NSDate *)mostRecentMessageTimestampForRoom:(XMPPJID *)roomJID stream:(XMPPStream *)stream; | ||
|
||
/** | ||
* Returns the occupant for the given jid. | ||
**/ | ||
- (XMPPRoomOccupantCoreDataStorageObject *)occupantForJID:(XMPPJID *)jid inContext:(NSManagedObjectContext *)moc; | ||
|
||
@end |
Oops, something went wrong.