forked from mirrors/linphone-iphone
implement message delivery status notification
This commit is contained in:
parent
2049dccd0e
commit
0caa3e9461
22 changed files with 162 additions and 53 deletions
|
|
@ -29,5 +29,6 @@
|
|||
@property (nonatomic, retain) NSString *remoteAddress;
|
||||
|
||||
- (void)addChatEntry:(ChatModel*)chat;
|
||||
- (void)updateChatEntry:(ChatModel*)chat;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -71,7 +71,19 @@
|
|||
[self.tableView endUpdates];
|
||||
[self scrollToLastUnread:true];
|
||||
}
|
||||
|
||||
- (void)updateChatEntry:(ChatModel*)chat {
|
||||
if(data == nil) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update entry: null data"];
|
||||
return;
|
||||
}
|
||||
NSInteger index = [data indexOfObject:chat];
|
||||
if (index<0) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"chat entries diesn not exixt"];
|
||||
return;
|
||||
}
|
||||
[[self tableView] reloadData]; //just reload
|
||||
return;
|
||||
}
|
||||
- (void)scrollToLastUnread:(BOOL)animated {
|
||||
if(data == nil) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot add entry: null data"];
|
||||
|
|
|
|||
|
|
@ -186,6 +186,15 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
[avatarImage setImage:image];
|
||||
}
|
||||
static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud) {
|
||||
ChatRoomViewController* thiz=(ChatRoomViewController*)ud;
|
||||
ChatModel *chat = (ChatModel *)linphone_chat_message_get_user_data(msg);
|
||||
[LinphoneLogger log:LinphoneLoggerLog
|
||||
format:@"Delivery status for [%@] is [%s]",chat.message,linphone_chat_message_state_to_string(state)];
|
||||
[chat setState:[NSNumber numberWithInt:state]];
|
||||
[chat update];
|
||||
[thiz.tableController updateChatEntry:chat];
|
||||
}
|
||||
|
||||
- (BOOL)sendMessage:(NSString *)message {
|
||||
if(![LinphoneManager isLcReady]) {
|
||||
|
|
@ -211,6 +220,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
chatRoom = linphone_core_create_chat_room([LinphoneManager getLc], [remoteAddress UTF8String]);
|
||||
|
||||
}
|
||||
|
||||
// Save message in database
|
||||
|
|
@ -221,11 +231,13 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[chat setDirection:[NSNumber numberWithInt:0]];
|
||||
[chat setTime:[NSDate date]];
|
||||
[chat setRead:[NSNumber numberWithInt:1]];
|
||||
[chat setState:[NSNumber numberWithInt:1]]; //INPROGRESS
|
||||
[chat create];
|
||||
[tableController addChatEntry:chat];
|
||||
[chat release];
|
||||
|
||||
linphone_chat_room_send_message(chatRoom, [message UTF8String]);
|
||||
LinphoneChatMessage* msg = linphone_chat_room_create_message(chatRoom,[message UTF8String]);
|
||||
linphone_chat_message_set_user_data(msg,chat);
|
||||
linphone_chat_room_send_message2(chatRoom, msg,message_status,self);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#import "Utils.h"
|
||||
|
||||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
|
||||
|
||||
@implementation DialerViewController
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#import "UIConferenceHeader.h"
|
||||
#import "LinphoneManager.h"
|
||||
|
||||
#include "private.h"
|
||||
|
||||
|
||||
@implementation InCallTableViewController
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ enum TableSection {
|
|||
+ (bool)isInConference:(LinphoneCall*) call {
|
||||
if (!call)
|
||||
return false;
|
||||
return linphone_call_get_current_params(call)->in_conference;
|
||||
return linphone_call_is_in_conference(call);
|
||||
}
|
||||
|
||||
+ (int)callCount:(LinphoneCore*) lc {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#import "UILinphone.h"
|
||||
|
||||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
|
||||
|
||||
const NSInteger SECURE_BUTTON_TAG=5;
|
||||
|
||||
|
|
@ -428,7 +428,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[videoWaitingForFirstImage startAnimating];
|
||||
|
||||
LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
|
||||
if (call != NULL && call->videostream) {
|
||||
//linphone_call_params_get_used_video_codec return 0 if no video stream enabled
|
||||
if (call != NULL && linphone_call_params_get_used_video_codec(linphone_call_get_current_params(call))) {
|
||||
linphone_call_set_next_video_frame_decoded_callback(call, hideSpinner, self);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "linphonecore_utils.h"
|
||||
#include "lpconfig.h"
|
||||
#include "private.h"
|
||||
|
||||
|
||||
static LinphoneCore* theLinphoneCore = nil;
|
||||
static LinphoneManager* theLinphoneManager = nil;
|
||||
|
|
@ -231,13 +231,27 @@ struct codec_name_pref_table codec_pref_table[]={
|
|||
#pragma mark - Database Functions
|
||||
|
||||
- (void)openDatabase {
|
||||
NSString *src = [LinphoneManager bundleFile:@"database.sqlite"];
|
||||
NSString *dst = [LinphoneManager documentFile:@"database.sqlite"];
|
||||
[LinphoneManager copyFile:src destination:dst override:FALSE];
|
||||
|
||||
if(sqlite3_open([dst UTF8String], &database) != SQLITE_OK) {
|
||||
[LinphoneLogger log:LinphoneLoggerError format:@"Can't open \"%@\" sqlite3 database.", dst];
|
||||
}
|
||||
NSString *databasePath = [LinphoneManager documentFile:@"chat_database.sqlite"];
|
||||
NSFileManager *filemgr = [NSFileManager defaultManager];
|
||||
//[filemgr removeItemAtPath:databasePath error:nil];
|
||||
BOOL firstInstall= ![filemgr fileExistsAtPath: databasePath ];
|
||||
|
||||
if(sqlite3_open([databasePath UTF8String], &database) != SQLITE_OK) {
|
||||
[LinphoneLogger log:LinphoneLoggerError format:@"Can't open \"%@\" sqlite3 database.", databasePath];
|
||||
return;
|
||||
}
|
||||
|
||||
if (firstInstall) {
|
||||
char *errMsg;
|
||||
//better to create the db from the code
|
||||
const char *sql_stmt = "CREATE TABLE chat (id INTEGER PRIMARY KEY AUTOINCREMENT, localContact TEXT NOT NULL, remoteContact TEXT NOT NULL, direction INTEGER, message TEXT NOT NULL, time NUMERIC, read INTEGER, state INTEGER)";
|
||||
|
||||
if (sqlite3_exec(database, sql_stmt, NULL, NULL, &errMsg) != SQLITE_OK) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Can't create table error[%s] ", errMsg];
|
||||
}
|
||||
}
|
||||
|
||||
[filemgr release];
|
||||
}
|
||||
|
||||
- (void)closeDatabase {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#import "Utils.h"
|
||||
|
||||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
|
||||
@implementation UICallBar
|
||||
|
||||
|
|
@ -218,6 +217,10 @@
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:kLinphoneCallUpdate
|
||||
object:nil];
|
||||
if (linphone_core_get_calls_nb([LinphoneManager getLc]) == 0) {
|
||||
//reseting speaker button because no more call
|
||||
speakerButton.selected=FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Event Functions
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
@property (nonatomic, retain) IBOutlet UILabel *messageLabel;
|
||||
@property (nonatomic, retain) IBOutlet UIButton *deleteButton;
|
||||
@property (nonatomic, retain) IBOutlet UILabel *dateLabel;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIImageView* statusImage;
|
||||
- (id)initWithIdentifier:(NSString*)identifier;
|
||||
+ (CGFloat)height:(ChatModel*)chat width:(int)width;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#import "Utils.h"
|
||||
|
||||
#import <NinePatch.h>
|
||||
#include "linphonecore.h"
|
||||
|
||||
@implementation UIChatRoomCell
|
||||
|
||||
|
|
@ -31,6 +32,7 @@
|
|||
@synthesize deleteButton;
|
||||
@synthesize dateLabel;
|
||||
@synthesize chat;
|
||||
@synthesize statusImage;
|
||||
|
||||
static const CGFloat CELL_MIN_HEIGHT = 40.0f;
|
||||
static const CGFloat CELL_MIN_WIDTH = 150.0f;
|
||||
|
|
@ -59,7 +61,7 @@ static UIFont *CELL_FONT = nil;
|
|||
[messageLabel release];
|
||||
[deleteButton release];
|
||||
[dateLabel release];
|
||||
|
||||
[statusImage release];
|
||||
[chat release];
|
||||
|
||||
[super dealloc];
|
||||
|
|
@ -96,6 +98,18 @@ static UIFont *CELL_FONT = nil;
|
|||
[dateFormatter setLocale:locale];
|
||||
[dateLabel setText:[dateFormatter stringFromDate:[chat time]]];
|
||||
[dateFormatter release];
|
||||
if ([chat.state intValue] == LinphoneChatMessageStateInProgress) {
|
||||
[statusImage setImage:[UIImage imageNamed:@"chat_message_inprogress.png"] ];
|
||||
statusImage.hidden=FALSE;
|
||||
} else if ([chat.state intValue] == LinphoneChatMessageStateDelivered) {
|
||||
[statusImage setImage:[UIImage imageNamed:@"chat_message_delivered.png"] ];
|
||||
statusImage.hidden=FALSE;
|
||||
} else if ([chat.state intValue] == LinphoneChatMessageStateNotDelivered) {
|
||||
[statusImage setImage:[UIImage imageNamed:@"chat_message_not_delivered.png"]];
|
||||
statusImage.hidden=FALSE;
|
||||
} else {
|
||||
statusImage.hidden=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setEditing:(BOOL)editing {
|
||||
|
|
|
|||
|
|
@ -3,19 +3,19 @@
|
|||
<data>
|
||||
<int key="IBDocument.SystemTarget">1296</int>
|
||||
<string key="IBDocument.SystemVersion">11E53</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2549</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.47</string>
|
||||
<string key="IBDocument.HIToolboxVersion">569.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">1498</string>
|
||||
<string key="NS.object.0">1181</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIButton</string>
|
||||
<string>IBUIImageView</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBUIView</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBProxyObject</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
|
|
@ -131,9 +131,10 @@
|
|||
<object class="IBUILabel" id="504194589">
|
||||
<reference key="NSNextResponder" ref="456806949"/>
|
||||
<int key="NSvFlags">265</int>
|
||||
<string key="NSFrame">{{14, 107}, {280, 7}}</string>
|
||||
<string key="NSFrame">{{14, 107}, {260, 7}}</string>
|
||||
<reference key="NSSuperview" ref="456806949"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="197441422"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
|
|
@ -144,17 +145,33 @@
|
|||
<reference key="IBUITextColor" ref="479423909"/>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">0</int>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
<float key="IBUIMinimumFontSize">8</float>
|
||||
<int key="IBUITextAlignment">2</int>
|
||||
<object class="IBUIFontDescription" key="IBUIFontDescription">
|
||||
<int key="type">1</int>
|
||||
<double key="pointSize">10</double>
|
||||
<double key="pointSize">9</double>
|
||||
</object>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">10</double>
|
||||
<double key="NSSize">9</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
</object>
|
||||
<object class="IBUIImageView" id="197441422">
|
||||
<reference key="NSNextResponder" ref="456806949"/>
|
||||
<int key="NSvFlags">265</int>
|
||||
<string key="NSFrame">{{284, 104}, {10, 10}}</string>
|
||||
<reference key="NSSuperview" ref="456806949"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">chat_message_not_delivered.png</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrame">{{13, 13}, {294, 114}}</string>
|
||||
|
|
@ -186,6 +203,7 @@
|
|||
<string key="NSFrameSize">{100, 100}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<reference key="IBUIBackgroundColor" ref="765717609"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
|
|
@ -196,6 +214,7 @@
|
|||
<string key="NSFrameSize">{100, 100}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<reference key="IBUIBackgroundColor" ref="765717609"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
|
|
@ -267,6 +286,14 @@
|
|||
</object>
|
||||
<int key="connectionID">25</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">statusImage</string>
|
||||
<reference key="source" ref="841351856"/>
|
||||
<reference key="destination" ref="197441422"/>
|
||||
</object>
|
||||
<int key="connectionID">27</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">onDeleteClick:</string>
|
||||
|
|
@ -331,6 +358,7 @@
|
|||
<reference ref="281972462"/>
|
||||
<reference ref="859609488"/>
|
||||
<reference ref="504194589"/>
|
||||
<reference ref="197441422"/>
|
||||
</array>
|
||||
<reference key="parent" ref="579600281"/>
|
||||
<string key="objectName">messageView</string>
|
||||
|
|
@ -353,6 +381,12 @@
|
|||
<reference key="parent" ref="456806949"/>
|
||||
<string key="objectName">timestampLabel</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">26</int>
|
||||
<reference key="object" ref="197441422"/>
|
||||
<reference key="parent" ref="456806949"/>
|
||||
<string key="objectName">status</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
|
@ -367,6 +401,7 @@
|
|||
<real value="1" key="18.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="22.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="26.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="3.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
|
|
@ -375,7 +410,7 @@
|
|||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">25</int>
|
||||
<int key="maxID">27</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
|
@ -400,6 +435,7 @@
|
|||
<string key="innerView">UIView</string>
|
||||
<string key="messageLabel">UILabel</string>
|
||||
<string key="messageView">UIView</string>
|
||||
<string key="statusImage">UIImageView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="backgroundImage">
|
||||
|
|
@ -426,6 +462,10 @@
|
|||
<string key="name">messageView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="statusImage">
|
||||
<string key="name">statusImage</string>
|
||||
<string key="candidateClassName">UIImageView</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
|
|
@ -444,9 +484,10 @@
|
|||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="chat_bubble_incoming.png">{71, 46}</string>
|
||||
<string key="chat_message_not_delivered.png">{18, 17}</string>
|
||||
<string key="list_delete_default.png">{45, 45}</string>
|
||||
<string key="list_delete_over.png">{45, 45}</string>
|
||||
</dictionary>
|
||||
<string key="IBCocoaTouchPluginVersion">1498</string>
|
||||
<string key="IBCocoaTouchPluginVersion">1181</string>
|
||||
</data>
|
||||
</archive>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#import "UIHangUpButton.h"
|
||||
#import "LinphoneManager.h"
|
||||
|
||||
#import "private.h"
|
||||
|
||||
@implementation UIHangUpButton
|
||||
|
||||
|
|
@ -30,7 +29,7 @@
|
|||
+ (bool)isInConference:(LinphoneCall*) call {
|
||||
if (!call)
|
||||
return false;
|
||||
return linphone_call_get_current_params(call)->in_conference;
|
||||
return linphone_call_is_in_conference(call);
|
||||
}
|
||||
|
||||
+ (int)callCount:(LinphoneCore*) lc {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#import "LinphoneManager.h"
|
||||
|
||||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
|
||||
|
||||
@implementation UIPauseButton
|
||||
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
+ (bool)isInConference: (LinphoneCall*) call {
|
||||
if (!call)
|
||||
return false;
|
||||
return linphone_call_get_current_params(call)->in_conference;
|
||||
return linphone_call_is_in_conference(call);
|
||||
}
|
||||
|
||||
+ (int)notInConferenceCallCount: (LinphoneCore*) lc {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface ChatModel : NSObject {
|
||||
@private
|
||||
NSNumber *chatId;
|
||||
|
|
@ -28,6 +29,7 @@
|
|||
NSString *message;
|
||||
NSDate *time;
|
||||
NSNumber *read;
|
||||
NSNumber *state; //0 IDLE, 1 in progress, 2 delivered, 3 not delivered see LinphoneChatMessageState
|
||||
}
|
||||
|
||||
@property (readonly) NSNumber *chatId;
|
||||
|
|
@ -37,6 +39,7 @@
|
|||
@property (copy) NSString *message;
|
||||
@property (copy) NSDate *time;
|
||||
@property (copy) NSNumber *read;
|
||||
@property (copy) NSNumber *state;
|
||||
|
||||
- (void)create;
|
||||
+ (ChatModel*)read:(NSNumber*)id;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
@synthesize direction;
|
||||
@synthesize time;
|
||||
@synthesize read;
|
||||
|
||||
@synthesize state;
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
|
|
@ -43,6 +43,7 @@
|
|||
self.message = [NSString stringWithUTF8String: (const char*) sqlite3_column_text(sqlStatement, 4)];
|
||||
self.time = [NSDate dateWithTimeIntervalSince1970:sqlite3_column_int(sqlStatement, 5)];
|
||||
self.read = [NSNumber numberWithInt:sqlite3_column_int(sqlStatement, 6)];
|
||||
self.state = [NSNumber numberWithInt:sqlite3_column_int(sqlStatement, 7)];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
@ -55,7 +56,7 @@
|
|||
[direction release];
|
||||
[time release];
|
||||
[read release];
|
||||
|
||||
[state release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +70,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const char *sql = "INSERT INTO chat (localContact, remoteContact, direction, message, time, read) VALUES (@LOCALCONTACT, @REMOTECONTACT, @DIRECTION, @MESSAGE, @TIME, @READ)";
|
||||
const char *sql = "INSERT INTO chat (localContact, remoteContact, direction, message, time, read, state) VALUES (@LOCALCONTACT, @REMOTECONTACT, @DIRECTION, @MESSAGE, @TIME, @READ, @STATE)";
|
||||
sqlite3_stmt *sqlStatement;
|
||||
if (sqlite3_prepare_v2(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
|
|
@ -83,6 +84,7 @@
|
|||
sqlite3_bind_text(sqlStatement, 4, [message UTF8String], -1, SQLITE_STATIC);
|
||||
sqlite3_bind_double(sqlStatement, 5, [time timeIntervalSince1970]);
|
||||
sqlite3_bind_int(sqlStatement, 6, [read intValue]);
|
||||
sqlite3_bind_int(sqlStatement, 7, [state intValue]);
|
||||
|
||||
if (sqlite3_step(sqlStatement) != SQLITE_DONE) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
|
|
@ -134,7 +136,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const char *sql = "UPDATE chat SET localContact=@LOCALCONTACT, remoteContact=@REMOTECONTACT, direction=@DIRECTION, message=@MESSAGE, time=@TIME, read=@READ WHERE id=@ID";
|
||||
const char *sql = "UPDATE chat SET localContact=@LOCALCONTACT, remoteContact=@REMOTECONTACT, direction=@DIRECTION, message=@MESSAGE, time=@TIME, read=@READ, state=@STATE WHERE id=@ID";
|
||||
sqlite3_stmt *sqlStatement;
|
||||
if (sqlite3_prepare_v2(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Can't prepare the query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
|
|
@ -148,7 +150,8 @@
|
|||
sqlite3_bind_text(sqlStatement, 4, [message UTF8String], -1, SQLITE_STATIC);
|
||||
sqlite3_bind_double(sqlStatement, 5, [time timeIntervalSince1970]);
|
||||
sqlite3_bind_int(sqlStatement, 6, [read intValue]);
|
||||
sqlite3_bind_int(sqlStatement, 7, [chatId intValue]);
|
||||
sqlite3_bind_int(sqlStatement, 7, [state intValue]);
|
||||
sqlite3_bind_int(sqlStatement, 8, [chatId intValue]);
|
||||
|
||||
if (sqlite3_step(sqlStatement) != SQLITE_DONE) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
|
|
@ -196,7 +199,7 @@
|
|||
return array;
|
||||
}
|
||||
|
||||
const char *sql = "SELECT id, localContact, remoteContact, direction, message, time, read FROM chat GROUP BY remoteContact ORDER BY time DESC";
|
||||
const char *sql = "SELECT id, localContact, remoteContact, direction, message, time, read, state FROM chat GROUP BY remoteContact ORDER BY time DESC";
|
||||
sqlite3_stmt *sqlStatement;
|
||||
if (sqlite3_prepare_v2(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Can't execute the query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
|
|
@ -228,7 +231,7 @@
|
|||
return array;
|
||||
}
|
||||
|
||||
const char *sql = "SELECT id, localContact, remoteContact, direction, message, time, read FROM chat WHERE remoteContact=@REMOTECONTACT ORDER BY time ASC";
|
||||
const char *sql = "SELECT id, localContact, remoteContact, direction, message, time, read, state FROM chat WHERE remoteContact=@REMOTECONTACT ORDER BY time ASC";
|
||||
sqlite3_stmt *sqlStatement;
|
||||
if (sqlite3_prepare_v2(database, sql, -1, &sqlStatement, NULL) != SQLITE_OK) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Can't execute the query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
|
|
|
|||
BIN
Resources/chat_message_delivered.png
Normal file
BIN
Resources/chat_message_delivered.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Resources/chat_message_inprogress.png
Normal file
BIN
Resources/chat_message_inprogress.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 684 B |
BIN
Resources/chat_message_not_delivered.png
Normal file
BIN
Resources/chat_message_not_delivered.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
|
@ -35,6 +35,12 @@
|
|||
223148E61178A09900637D6A /* libmsilbc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 223148E51178A09900637D6A /* libmsilbc.a */; };
|
||||
2234C8CA15ED049A00E18E83 /* DialerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2234C8C715ED049A00E18E83 /* DialerViewController.xib */; };
|
||||
2234C8CB15ED049A00E18E83 /* DialerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2234C8C715ED049A00E18E83 /* DialerViewController.xib */; };
|
||||
2234C8E915EE2F7F00E18E83 /* chat_message_delivered.png in Resources */ = {isa = PBXBuildFile; fileRef = 2234C8E715EE2F7F00E18E83 /* chat_message_delivered.png */; };
|
||||
2234C8EA15EE2F7F00E18E83 /* chat_message_delivered.png in Resources */ = {isa = PBXBuildFile; fileRef = 2234C8E715EE2F7F00E18E83 /* chat_message_delivered.png */; };
|
||||
2234C8EB15EE2F7F00E18E83 /* chat_message_not_delivered.png in Resources */ = {isa = PBXBuildFile; fileRef = 2234C8E815EE2F7F00E18E83 /* chat_message_not_delivered.png */; };
|
||||
2234C8EC15EE2F7F00E18E83 /* chat_message_not_delivered.png in Resources */ = {isa = PBXBuildFile; fileRef = 2234C8E815EE2F7F00E18E83 /* chat_message_not_delivered.png */; };
|
||||
2234C8EE15EE744200E18E83 /* chat_message_inprogress.png in Resources */ = {isa = PBXBuildFile; fileRef = 2234C8ED15EE744200E18E83 /* chat_message_inprogress.png */; };
|
||||
2234C8EF15EE744200E18E83 /* chat_message_inprogress.png in Resources */ = {isa = PBXBuildFile; fileRef = 2234C8ED15EE744200E18E83 /* chat_message_inprogress.png */; };
|
||||
2237D4091084D7A9001383EE /* ring.wav in Resources */ = {isa = PBXBuildFile; fileRef = 2237D4081084D7A9001383EE /* ring.wav */; };
|
||||
2242E313125235120061DDCE /* ring.caf in Resources */ = {isa = PBXBuildFile; fileRef = 2242E312125235120061DDCE /* ring.caf */; };
|
||||
224567C2107B968500F10948 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 224567C1107B968500F10948 /* AVFoundation.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
|
|
@ -208,7 +214,6 @@
|
|||
D32B6E2415A5B2020033019F /* chat_send_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = D32B6E2315A5B2020033019F /* chat_send_disabled.png */; };
|
||||
D32B6E2915A5BC440033019F /* ChatRoomTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D32B6E2815A5BC430033019F /* ChatRoomTableViewController.m */; };
|
||||
D32B6E2A15A5BC440033019F /* ChatRoomTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D32B6E2815A5BC430033019F /* ChatRoomTableViewController.m */; };
|
||||
D32B6E2C15A5C0800033019F /* database.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = D32B6E2B15A5C0800033019F /* database.sqlite */; };
|
||||
D32B6E2F15A5C0AC0033019F /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D32B6E2E15A5C0AC0033019F /* libsqlite3.dylib */; };
|
||||
D32B6E3815A5C2430033019F /* ChatModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D32B6E3715A5C2430033019F /* ChatModel.m */; };
|
||||
D32B6E3915A5C2430033019F /* ChatModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D32B6E3715A5C2430033019F /* ChatModel.m */; };
|
||||
|
|
@ -410,7 +415,6 @@
|
|||
D34BD67415C13DB70070C209 /* contacts_linphone_selected.png in Resources */ = {isa = PBXBuildFile; fileRef = D354980415875534000081D8 /* contacts_linphone_selected.png */; };
|
||||
D34BD67515C13DB70070C209 /* contacts_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D38327FC158100E400FA0D23 /* contacts_over.png */; };
|
||||
D34BD67615C13DB70070C209 /* contacts_selected.png in Resources */ = {isa = PBXBuildFile; fileRef = D38327EC1580FE3A00FA0D23 /* contacts_selected.png */; };
|
||||
D34BD67715C13DB70070C209 /* database.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = D32B6E2B15A5C0800033019F /* database.sqlite */; };
|
||||
D34BD67815C13DB70070C209 /* decline_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3F83F761582253100336684 /* decline_default.png */; };
|
||||
D34BD67915C13DB70070C209 /* decline_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3F83F771582253100336684 /* decline_over.png */; };
|
||||
D34BD67A15C13DB70070C209 /* dialer_address_background.png in Resources */ = {isa = PBXBuildFile; fileRef = D3ED3E441585FB8C006C0DE4 /* dialer_address_background.png */; };
|
||||
|
|
@ -1340,6 +1344,9 @@
|
|||
223148E31178A08200637D6A /* libilbc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libilbc.a; path = "liblinphone-sdk/apple-darwin/lib/libilbc.a"; sourceTree = "<group>"; };
|
||||
223148E51178A09900637D6A /* libmsilbc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmsilbc.a; path = "liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/libmsilbc.a"; sourceTree = "<group>"; };
|
||||
2234C8C715ED049A00E18E83 /* DialerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DialerViewController.xib; sourceTree = "<group>"; };
|
||||
2234C8E715EE2F7F00E18E83 /* chat_message_delivered.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = chat_message_delivered.png; path = Resources/chat_message_delivered.png; sourceTree = "<group>"; };
|
||||
2234C8E815EE2F7F00E18E83 /* chat_message_not_delivered.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = chat_message_not_delivered.png; path = Resources/chat_message_not_delivered.png; sourceTree = "<group>"; };
|
||||
2234C8ED15EE744200E18E83 /* chat_message_inprogress.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = chat_message_inprogress.png; path = Resources/chat_message_inprogress.png; sourceTree = "<group>"; };
|
||||
2237D4081084D7A9001383EE /* ring.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = ring.wav; path = Resources/ring.wav; sourceTree = "<group>"; };
|
||||
2242E312125235120061DDCE /* ring.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = ring.caf; path = Resources/ring.caf; sourceTree = "<group>"; };
|
||||
224567C1107B968500F10948 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
|
||||
|
|
@ -1549,7 +1556,6 @@
|
|||
D32B6E2315A5B2020033019F /* chat_send_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = chat_send_disabled.png; path = Resources/chat_send_disabled.png; sourceTree = "<group>"; };
|
||||
D32B6E2715A5BC430033019F /* ChatRoomTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatRoomTableViewController.h; sourceTree = "<group>"; };
|
||||
D32B6E2815A5BC430033019F /* ChatRoomTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatRoomTableViewController.m; sourceTree = "<group>"; };
|
||||
D32B6E2B15A5C0800033019F /* database.sqlite */ = {isa = PBXFileReference; lastKnownFileType = file; name = database.sqlite; path = Resources/database.sqlite; sourceTree = "<group>"; };
|
||||
D32B6E2E15A5C0AC0033019F /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
|
||||
D32B6E3615A5C2430033019F /* ChatModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChatModel.h; path = Model/ChatModel.h; sourceTree = "<group>"; };
|
||||
D32B6E3715A5C2430033019F /* ChatModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = ChatModel.m; path = Model/ChatModel.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
|
|
@ -2659,6 +2665,9 @@
|
|||
57F005C615EE2D9200914747 /* linphonerc-factory */,
|
||||
57F005C715EE2D9200914747 /* linphonerc-factory~ipad */,
|
||||
57F005C315EE2CCF00914747 /* linphonerc */,
|
||||
2234C8ED15EE744200E18E83 /* chat_message_inprogress.png */,
|
||||
2234C8E715EE2F7F00E18E83 /* chat_message_delivered.png */,
|
||||
2234C8E815EE2F7F00E18E83 /* chat_message_not_delivered.png */,
|
||||
D3F83F741582253100336684 /* accept_default.png */,
|
||||
D3F83F751582253100336684 /* accept_over.png */,
|
||||
D3D6A39B159B0EEF005F692C /* add_call_default.png */,
|
||||
|
|
@ -2786,7 +2795,6 @@
|
|||
D38327EC1580FE3A00FA0D23 /* contacts_selected.png */,
|
||||
D3A74E7A15C69392001500B9 /* contacts_selected_landscape~ipad.png */,
|
||||
D3A74E7B15C69392001500B9 /* contacts_selected~ipad.png */,
|
||||
D32B6E2B15A5C0800033019F /* database.sqlite */,
|
||||
D3F83F761582253100336684 /* decline_default.png */,
|
||||
D3F83F771582253100336684 /* decline_over.png */,
|
||||
D3ED3E441585FB8C006C0DE4 /* dialer_address_background.png */,
|
||||
|
|
@ -3532,7 +3540,6 @@
|
|||
D3B9A3E515A58C450096EA4E /* chat_send_default.png in Resources */,
|
||||
D3B9A3E715A58C450096EA4E /* chat_send_over.png in Resources */,
|
||||
D32B6E2415A5B2020033019F /* chat_send_disabled.png in Resources */,
|
||||
D32B6E2C15A5C0800033019F /* database.sqlite in Resources */,
|
||||
D3A8BB7415A6C81A00F96BE5 /* UIChatRoomCell.xib in Resources */,
|
||||
D3A8BB7B15A6CC3200F96BE5 /* chat_bubble_outgoing.png in Resources */,
|
||||
D3A8BB7D15A6CC3200F96BE5 /* chat_bubble_incoming.png in Resources */,
|
||||
|
|
@ -3765,6 +3772,9 @@
|
|||
57F005C415EE2CCF00914747 /* linphonerc in Resources */,
|
||||
57F005C815EE2D9200914747 /* linphonerc-factory in Resources */,
|
||||
57F005CA15EE2D9200914747 /* linphonerc-factory~ipad in Resources */,
|
||||
2234C8E915EE2F7F00E18E83 /* chat_message_delivered.png in Resources */,
|
||||
2234C8EB15EE2F7F00E18E83 /* chat_message_not_delivered.png in Resources */,
|
||||
2234C8EE15EE744200E18E83 /* chat_message_inprogress.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -3892,7 +3902,6 @@
|
|||
D34BD67415C13DB70070C209 /* contacts_linphone_selected.png in Resources */,
|
||||
D34BD67515C13DB70070C209 /* contacts_over.png in Resources */,
|
||||
D34BD67615C13DB70070C209 /* contacts_selected.png in Resources */,
|
||||
D34BD67715C13DB70070C209 /* database.sqlite in Resources */,
|
||||
D34BD67815C13DB70070C209 /* decline_default.png in Resources */,
|
||||
D34BD67915C13DB70070C209 /* decline_over.png in Resources */,
|
||||
D34BD67A15C13DB70070C209 /* dialer_address_background.png in Resources */,
|
||||
|
|
@ -4208,6 +4217,9 @@
|
|||
57F005C515EE2CCF00914747 /* linphonerc in Resources */,
|
||||
57F005C915EE2D9200914747 /* linphonerc-factory in Resources */,
|
||||
57F005CB15EE2D9200914747 /* linphonerc-factory~ipad in Resources */,
|
||||
2234C8EA15EE2F7F00E18E83 /* chat_message_delivered.png in Resources */,
|
||||
2234C8EC15EE2F7F00E18E83 /* chat_message_not_delivered.png in Resources */,
|
||||
2234C8EF15EE744200E18E83 /* chat_message_inprogress.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1812,7 +1812,6 @@
|
|||
"POSIXTIMER_INTERVAL=10000",
|
||||
IN_LINPHONE,
|
||||
__MAC_AQ_ENABLED__,
|
||||
HAVE_EXOSIP_GET_SOCKET,
|
||||
MS2_INTERNAL,
|
||||
VIDEO_ENABLED,
|
||||
HAVE_LIBAVCODEC_AVCODEC_H,
|
||||
|
|
@ -1871,7 +1870,6 @@
|
|||
"POSIXTIMER_INTERVAL=10000",
|
||||
IN_LINPHONE,
|
||||
__MAC_AQ_ENABLED__,
|
||||
HAVE_EXOSIP_GET_SOCKET,
|
||||
MS2_INTERNAL,
|
||||
VIDEO_ENABLED,
|
||||
HAVE_LIBAVCODEC_AVCODEC_H,
|
||||
|
|
@ -2196,7 +2194,6 @@
|
|||
"POSIXTIMER_INTERVAL=10000",
|
||||
IN_LINPHONE,
|
||||
__MAC_AQ_ENABLED__,
|
||||
HAVE_EXOSIP_GET_SOCKET,
|
||||
MS2_INTERNAL,
|
||||
VIDEO_ENABLED,
|
||||
HAVE_LIBAVCODEC_AVCODEC_H,
|
||||
|
|
@ -2256,7 +2253,6 @@
|
|||
"POSIXTIMER_INTERVAL=10000",
|
||||
IN_LINPHONE,
|
||||
__MAC_AQ_ENABLED__,
|
||||
HAVE_EXOSIP_GET_SOCKET,
|
||||
MS2_INTERNAL,
|
||||
VIDEO_ENABLED,
|
||||
HAVE_LIBAVCODEC_AVCODEC_H,
|
||||
|
|
@ -2316,7 +2312,6 @@
|
|||
"POSIXTIMER_INTERVAL=10000",
|
||||
IN_LINPHONE,
|
||||
__MAC_AQ_ENABLED__,
|
||||
HAVE_EXOSIP_GET_SOCKET,
|
||||
MS2_INTERNAL,
|
||||
VIDEO_ENABLED,
|
||||
HAVE_LIBAVCODEC_AVCODEC_H,
|
||||
|
|
@ -2416,7 +2411,6 @@
|
|||
"POSIXTIMER_INTERVAL=10000",
|
||||
IN_LINPHONE,
|
||||
__MAC_AQ_ENABLED__,
|
||||
HAVE_EXOSIP_GET_SOCKET,
|
||||
MS2_INTERNAL,
|
||||
VIDEO_ENABLED,
|
||||
HAVE_LIBAVCODEC_AVCODEC_H,
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 5139b557f8c922f16b4b2808d62cf63bdc293274
|
||||
Subproject commit d98fa4ed52f40001bef50be65c971a52ab845660
|
||||
Loading…
Add table
Reference in a new issue