Fixed issues with going to sleep, getting Google Contacts, quitting, and SMS Sound notifications.
This commit is contained in:
parent
d78ec38bf9
commit
7a586f0eb1
@ -153,7 +153,7 @@ typedef enum {
|
|||||||
|
|
||||||
#if !TARGET_OS_IPHONE
|
#if !TARGET_OS_IPHONE
|
||||||
- (BOOL)setInputSoundDevice:(int)theInputDevice outputSoundDevice:(int)theOutputDevice;
|
- (BOOL)setInputSoundDevice:(int)theInputDevice outputSoundDevice:(int)theOutputDevice;
|
||||||
- (BOOL)stopSound;
|
- (BOOL)stopAudio;
|
||||||
- (void)updateAudioDevices;
|
- (void)updateAudioDevices;
|
||||||
- (NSArray *)audioDevices;
|
- (NSArray *)audioDevices;
|
||||||
#endif
|
#endif
|
||||||
|
@ -617,19 +617,20 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
|
|||||||
|
|
||||||
- (void)computerSleep {
|
- (void)computerSleep {
|
||||||
restartAccounts = [accounts copy];
|
restartAccounts = [accounts copy];
|
||||||
[self stopBackground];
|
[accounts makeObjectsPerformSelector:@selector(logout)];
|
||||||
|
#if !TARGET_OS_IPHONE
|
||||||
|
[self stopAudio];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
- (void)computerWake {
|
- (void)computerWake {
|
||||||
|
#if !TARGET_OS_IPHONE
|
||||||
|
[self updateAudioDevices];
|
||||||
|
#endif
|
||||||
if (restartAccounts!=nil) {
|
if (restartAccounts!=nil) {
|
||||||
for (int i=0; i<[restartAccounts count]; i++) {
|
[restartAccounts makeObjectsPerformSelector:@selector(login)];
|
||||||
if (![accounts containsObject:[restartAccounts objectAtIndex:i]])
|
|
||||||
[accounts addObject:[restartAccounts objectAtIndex:i]];
|
|
||||||
}
|
|
||||||
[restartAccounts release];
|
[restartAccounts release];
|
||||||
restartAccounts = nil;
|
restartAccounts = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self start];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)registerThread:(pj_thread_desc *)thePJThreadDesc {
|
- (void)registerThread:(pj_thread_desc *)thePJThreadDesc {
|
||||||
@ -845,7 +846,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
|
|||||||
bzero(&PJThreadDesc, sizeof(pj_thread_desc));
|
bzero(&PJThreadDesc, sizeof(pj_thread_desc));
|
||||||
return (status==PJ_SUCCESS);
|
return (status==PJ_SUCCESS);
|
||||||
}
|
}
|
||||||
- (BOOL)stopSound {
|
- (BOOL)stopAudio {
|
||||||
if (state!=MGMSIPStartedState)
|
if (state!=MGMSIPStartedState)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
|
@ -60,6 +60,10 @@
|
|||||||
NSString *prefix = [[self class] prefixForName:name];
|
NSString *prefix = [[self class] prefixForName:name];
|
||||||
NSString *uri = nil;
|
NSString *uri = nil;
|
||||||
if (prefix!=nil) {
|
if (prefix!=nil) {
|
||||||
|
if (MGMXMLNodePtr->doc==NULL) {
|
||||||
|
NSLog(@"You may not search for elements with a namespace if there is no document.");
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
xmlNsPtr namespace = xmlSearchNs(MGMXMLNodePtr->doc, MGMXMLNodePtr, [prefix xmlString]);
|
xmlNsPtr namespace = xmlSearchNs(MGMXMLNodePtr->doc, MGMXMLNodePtr, [prefix xmlString]);
|
||||||
if (namespace!=NULL)
|
if (namespace!=NULL)
|
||||||
uri = [NSString stringWithXMLString:namespace->href];
|
uri = [NSString stringWithXMLString:namespace->href];
|
||||||
|
@ -71,6 +71,7 @@ struct _xmlCom {
|
|||||||
xmlNsPtr namespaceXML;
|
xmlNsPtr namespaceXML;
|
||||||
xmlNodePtr parentNode;
|
xmlNodePtr parentNode;
|
||||||
MGMXMLNodeKind type;
|
MGMXMLNodeKind type;
|
||||||
|
MGMXMLNode *documentNode;
|
||||||
}
|
}
|
||||||
+ (id)nodeWithTypeXMLPtr:(xmlTypPtr)theXMLPtr;
|
+ (id)nodeWithTypeXMLPtr:(xmlTypPtr)theXMLPtr;
|
||||||
- (id)initWithTypeXMLPtr:(xmlTypPtr)theXMLPtr;
|
- (id)initWithTypeXMLPtr:(xmlTypPtr)theXMLPtr;
|
||||||
@ -81,6 +82,7 @@ struct _xmlCom {
|
|||||||
+ (void)removeChildrenFromNode:(xmlNodePtr)theNode;
|
+ (void)removeChildrenFromNode:(xmlNodePtr)theNode;
|
||||||
+ (void)freeNode:(xmlNodePtr)theNode;
|
+ (void)freeNode:(xmlNodePtr)theNode;
|
||||||
- (void)setTypeXMLPtr:(xmlTypPtr)theXMLPtr;
|
- (void)setTypeXMLPtr:(xmlTypPtr)theXMLPtr;
|
||||||
|
- (void)releaseDocument;
|
||||||
+ (BOOL)isNode:(MGMXMLNodeKind)theType;
|
+ (BOOL)isNode:(MGMXMLNodeKind)theType;
|
||||||
- (BOOL)isNode;
|
- (BOOL)isNode;
|
||||||
+ (NSError *)lastError;
|
+ (NSError *)lastError;
|
||||||
|
@ -84,6 +84,8 @@ static void MGMXMLErrorHandler(void *userData, xmlErrorPtr error) {
|
|||||||
parentNode = NULL;
|
parentNode = NULL;
|
||||||
}
|
}
|
||||||
if (commonXML!=NULL) {
|
if (commonXML!=NULL) {
|
||||||
|
if (type!=MGMXMLDocumentKind)
|
||||||
|
[self releaseDocument];
|
||||||
commonXML->_private = NULL;
|
commonXML->_private = NULL;
|
||||||
|
|
||||||
if (commonXML->parent==NULL) {
|
if (commonXML->parent==NULL) {
|
||||||
@ -91,7 +93,7 @@ static void MGMXMLErrorHandler(void *userData, xmlErrorPtr error) {
|
|||||||
xmlNodePtr child = commonXML->children;
|
xmlNodePtr child = commonXML->children;
|
||||||
while (child!=NULL) {
|
while (child!=NULL) {
|
||||||
xmlNodePtr nextChild = child->next;
|
xmlNodePtr nextChild = child->next;
|
||||||
if (child->type == XML_ELEMENT_NODE) {
|
if (child->type==MGMXMLElementKind) {
|
||||||
if (child->prev!=NULL)
|
if (child->prev!=NULL)
|
||||||
child->prev->next = child->next;
|
child->prev->next = child->next;
|
||||||
if (child->next!=NULL)
|
if (child->next!=NULL)
|
||||||
@ -199,7 +201,10 @@ static void MGMXMLErrorHandler(void *userData, xmlErrorPtr error) {
|
|||||||
theNode->parent = NULL;
|
theNode->parent = NULL;
|
||||||
theNode->prev = NULL;
|
theNode->prev = NULL;
|
||||||
theNode->next = NULL;
|
theNode->next = NULL;
|
||||||
if (theNode->doc!=NULL) [self stripDocumentFromNode:theNode];
|
if (theNode->doc!=NULL) {
|
||||||
|
[(MGMXMLNode *)theNode->_private releaseDocument];
|
||||||
|
[self stripDocumentFromNode:theNode];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,6 +224,14 @@ static void MGMXMLErrorHandler(void *userData, xmlErrorPtr error) {
|
|||||||
self->isa = [MGMXMLDocument class];
|
self->isa = [MGMXMLDocument class];
|
||||||
else if (type==MGMXMLElementKind && [self isMemberOfClass:[MGMXMLNode class]])
|
else if (type==MGMXMLElementKind && [self isMemberOfClass:[MGMXMLNode class]])
|
||||||
self->isa = [MGMXMLElement class];
|
self->isa = [MGMXMLElement class];
|
||||||
|
if (type!=MGMXMLDocumentKind)
|
||||||
|
documentNode = [[MGMXMLNode alloc] initWithTypeXMLPtr:(xmlTypPtr)commonXML->doc];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- (void)releaseDocument {
|
||||||
|
if (documentNode!=nil) {
|
||||||
|
[documentNode release];
|
||||||
|
documentNode = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ (BOOL)isNode:(MGMXMLNodeKind)theType {
|
+ (BOOL)isNode:(MGMXMLNodeKind)theType {
|
||||||
|
@ -60,6 +60,11 @@ NSString *MGMLastUserPhoneKey = @"MGMLastUserPhone";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
|
if (progressFadeAnimation!=nil) {
|
||||||
|
[progressFadeAnimation stopAnimation];
|
||||||
|
[progressFadeAnimation release];
|
||||||
|
progressFadeAnimation = nil;
|
||||||
|
}
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
if (instance!=nil) {
|
if (instance!=nil) {
|
||||||
[instance setDelegate:nil];
|
[instance setDelegate:nil];
|
||||||
|
@ -83,7 +83,7 @@ NSString * const MGMLogout = @"Logout";
|
|||||||
if ([[tableColumn identifier] isEqual:@"username"]) {
|
if ([[tableColumn identifier] isEqual:@"username"]) {
|
||||||
#if MGMSIPENABLED
|
#if MGMSIPENABLED
|
||||||
NSArray *users = [MGMUser users];
|
NSArray *users = [MGMUser users];
|
||||||
if ([users count]>=row)
|
if ([users count]<=row)
|
||||||
return nil;
|
return nil;
|
||||||
MGMUser *user = [MGMUser userWithID:[users objectAtIndex:row]];
|
MGMUser *user = [MGMUser userWithID:[users objectAtIndex:row]];
|
||||||
if ([[user settingForKey:MGMSAccountType] isEqual:MGMSSIP]) {
|
if ([[user settingForKey:MGMSAccountType] isEqual:MGMSSIP]) {
|
||||||
@ -94,7 +94,7 @@ NSString * const MGMLogout = @"Logout";
|
|||||||
return [[MGMUser userNames] objectAtIndex:row];
|
return [[MGMUser userNames] objectAtIndex:row];
|
||||||
} else if ([[tableColumn identifier] isEqual:@"state"]) {
|
} else if ([[tableColumn identifier] isEqual:@"state"]) {
|
||||||
NSDictionary *users = [MGMUser usersPlist];
|
NSDictionary *users = [MGMUser usersPlist];
|
||||||
if ([[users allKeys] count]>=row)
|
if ([[users allKeys] count]<=row)
|
||||||
return nil;
|
return nil;
|
||||||
return ([[users objectForKey:[[users allKeys] objectAtIndex:row]] boolValue] ? @"✓" : @"");
|
return ([[users objectForKey:[[users allKeys] objectAtIndex:row]] boolValue] ? @"✓" : @"");
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
if (shouldRestart) {
|
if (shouldRestart) {
|
||||||
/*NSAlert *alert = [[NSAlert new] autorelease];
|
NSAlert *alert = [[NSAlert new] autorelease];
|
||||||
[alert setMessageText:@"Restart Required"];
|
[alert setMessageText:@"Restart Required"];
|
||||||
[alert setInformativeText:@"You have changed some settings that requires you to restart VoiceMac for them to take place, do you want to restart VoiceMac now?"];
|
[alert setInformativeText:@"You have changed some settings that requires you to restart VoiceMac for them to take place, do you want to restart VoiceMac now?"];
|
||||||
[alert addButtonWithTitle:@"Yes"];
|
[alert addButtonWithTitle:@"Yes"];
|
||||||
@ -73,8 +73,8 @@
|
|||||||
NSString *relaunchPath = [[[NSBundle bundleWithIdentifier:@"org.andymatuschak.Sparkle"] resourcePath] stringByAppendingPathComponent:@"relaunch"];
|
NSString *relaunchPath = [[[NSBundle bundleWithIdentifier:@"org.andymatuschak.Sparkle"] resourcePath] stringByAppendingPathComponent:@"relaunch"];
|
||||||
[NSTask launchedTaskWithLaunchPath:relaunchPath arguments:[NSArray arrayWithObjects:pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], nil]];
|
[NSTask launchedTaskWithLaunchPath:relaunchPath arguments:[NSArray arrayWithObjects:pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], nil]];
|
||||||
[[NSApplication sharedApplication] terminate:self];
|
[[NSApplication sharedApplication] terminate:self];
|
||||||
}*/
|
}
|
||||||
[[MGMSIP sharedSIP] restart];
|
//[[MGMSIP sharedSIP] restart];
|
||||||
}
|
}
|
||||||
if (mainView!=nil)
|
if (mainView!=nil)
|
||||||
[mainView release];
|
[mainView release];
|
||||||
|
@ -62,6 +62,11 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
|
if (progressFadeAnimation!=nil) {
|
||||||
|
[progressFadeAnimation stopAnimation];
|
||||||
|
[progressFadeAnimation release];
|
||||||
|
progressFadeAnimation = nil;
|
||||||
|
}
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
if (calls!=nil) {
|
if (calls!=nil) {
|
||||||
[calls removeAllObjects];
|
[calls removeAllObjects];
|
||||||
|
@ -144,6 +144,7 @@ const float updateTimeInterval = 300.0;
|
|||||||
}
|
}
|
||||||
NSDate *newestDate = [NSDate distantPast];
|
NSDate *newestDate = [NSDate distantPast];
|
||||||
BOOL newMessage = NO;
|
BOOL newMessage = NO;
|
||||||
|
BOOL newTab = NO;
|
||||||
for (unsigned int i=0; i<[theMessages count]; i++) {
|
for (unsigned int i=0; i<[theMessages count]; i++) {
|
||||||
if ([lastDates objectForKey:[theInstance userNumber]]==nil || (![[lastDates objectForKey:[theInstance userNumber]] isEqual:[[theMessages objectAtIndex:i] objectForKey:MGMITime]] && [[lastDates objectForKey:[theInstance userNumber]] earlierDate:[[theMessages objectAtIndex:i] objectForKey:MGMITime]]==[lastDates objectForKey:[theInstance userNumber]])) {
|
if ([lastDates objectForKey:[theInstance userNumber]]==nil || (![[lastDates objectForKey:[theInstance userNumber]] isEqual:[[theMessages objectAtIndex:i] objectForKey:MGMITime]] && [[lastDates objectForKey:[theInstance userNumber]] earlierDate:[[theMessages objectAtIndex:i] objectForKey:MGMITime]]==[lastDates objectForKey:[theInstance userNumber]])) {
|
||||||
NSMutableDictionary *messageInfo = [NSMutableDictionary dictionaryWithDictionary:[theMessages objectAtIndex:i]];
|
NSMutableDictionary *messageInfo = [NSMutableDictionary dictionaryWithDictionary:[theMessages objectAtIndex:i]];
|
||||||
@ -151,16 +152,18 @@ const float updateTimeInterval = 300.0;
|
|||||||
[messageInfo removeObjectForKey:MGMIMessages];
|
[messageInfo removeObjectForKey:MGMIMessages];
|
||||||
[messageInfo setObject:[[theInstance contacts] nameForNumber:[messageInfo objectForKey:MGMIPhoneNumber]] forKey:MGMTInName];
|
[messageInfo setObject:[[theInstance contacts] nameForNumber:[messageInfo objectForKey:MGMIPhoneNumber]] forKey:MGMTInName];
|
||||||
[messageInfo setObject:[theInstance userNumber] forKey:MGMTUserNumber];
|
[messageInfo setObject:[theInstance userNumber] forKey:MGMTUserNumber];
|
||||||
BOOL window = NO;
|
BOOL tab = NO;
|
||||||
for (unsigned int m=0; m<[SMSMessages count]; m++) {
|
for (unsigned int m=0; m<[SMSMessages count]; m++) {
|
||||||
if ([[[[SMSMessages objectAtIndex:m] messageInfo] objectForKey:MGMIPhoneNumber] isEqual:[messageInfo objectForKey:MGMIPhoneNumber]] && ([[[[SMSMessages objectAtIndex:m] messageInfo] objectForKey:MGMIID] isEqual:[messageInfo objectForKey:MGMIID]] || [[[[SMSMessages objectAtIndex:m] messageInfo] objectForKey:MGMIID] isEqual:@""]) && [[SMSMessages objectAtIndex:m] instance]==theInstance) {
|
if ([[[[SMSMessages objectAtIndex:m] messageInfo] objectForKey:MGMIPhoneNumber] isEqual:[messageInfo objectForKey:MGMIPhoneNumber]] && ([[[[SMSMessages objectAtIndex:m] messageInfo] objectForKey:MGMIID] isEqual:[messageInfo objectForKey:MGMIID]] || [[[[SMSMessages objectAtIndex:m] messageInfo] objectForKey:MGMIID] isEqual:@""]) && [[SMSMessages objectAtIndex:m] instance]==theInstance) {
|
||||||
window = YES;
|
tab = YES;
|
||||||
[[SMSMessages objectAtIndex:m] updateWithMessages:messages messageInfo:messageInfo];
|
if ([[SMSMessages objectAtIndex:m] updateWithMessages:messages messageInfo:messageInfo])
|
||||||
|
newMessage = YES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!window && ![[[theMessages objectAtIndex:i] objectForKey:MGMIRead] boolValue]) {
|
if (!tab && ![[[theMessages objectAtIndex:i] objectForKey:MGMIRead] boolValue]) {
|
||||||
newMessage = YES;
|
newMessage = YES;
|
||||||
|
newTab = YES;
|
||||||
[SMSMessages addObject:[MGMSMSMessageView viewWithManager:self messages:messages messageInfo:messageInfo instance:theInstance]];
|
[SMSMessages addObject:[MGMSMSMessageView viewWithManager:self messages:messages messageInfo:messageInfo instance:theInstance]];
|
||||||
}
|
}
|
||||||
if ([newestDate earlierDate:[[theMessages objectAtIndex:i] objectForKey:MGMITime]]==newestDate)
|
if ([newestDate earlierDate:[[theMessages objectAtIndex:i] objectForKey:MGMITime]]==newestDate)
|
||||||
@ -168,10 +171,12 @@ const float updateTimeInterval = 300.0;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newMessage) {
|
if (newMessage) {
|
||||||
[self loadWindow];
|
|
||||||
[lastDates setObject:newestDate forKey:[theInstance userNumber]];
|
[lastDates setObject:newestDate forKey:[theInstance userNumber]];
|
||||||
[self reloadData];
|
|
||||||
[[controller themeManager] playSound:MGMTSSMSMessage];
|
[[controller themeManager] playSound:MGMTSSMSMessage];
|
||||||
|
}
|
||||||
|
if (newTab) {
|
||||||
|
[self loadWindow];
|
||||||
|
[self reloadData];
|
||||||
[SMSWindow makeKeyAndOrderFront:self];
|
[SMSWindow makeKeyAndOrderFront:self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
- (void)sendNotifications;
|
- (void)sendNotifications;
|
||||||
|
|
||||||
- (void)updateWithMessages:(NSArray *)theMessages messageInfo:(NSDictionary *)theMessageInfo;
|
- (BOOL)updateWithMessages:(NSArray *)theMessages messageInfo:(NSDictionary *)theMessageInfo;
|
||||||
|
|
||||||
- (void)buildHTML;
|
- (void)buildHTML;
|
||||||
- (void)addMessage:(NSDictionary *)theMessage;
|
- (void)addMessage:(NSDictionary *)theMessage;
|
||||||
|
@ -97,27 +97,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateWithMessages:(NSArray *)theMessages messageInfo:(NSDictionary *)theMessageInfo {
|
- (BOOL)updateWithMessages:(NSArray *)theMessages messageInfo:(NSDictionary *)theMessageInfo {
|
||||||
|
BOOL newIncomingMessages = NO;
|
||||||
if (![[theMessageInfo objectForKey:MGMITime] isEqual:[messageInfo objectForKey:MGMITime]]) {
|
if (![[theMessageInfo objectForKey:MGMITime] isEqual:[messageInfo objectForKey:MGMITime]]) {
|
||||||
if (messageInfo!=nil) [messageInfo release];
|
if (messageInfo!=nil) [messageInfo release];
|
||||||
messageInfo = [theMessageInfo mutableCopy];
|
messageInfo = [theMessageInfo mutableCopy];
|
||||||
BOOL read = [[messageInfo objectForKey:MGMIRead] boolValue];
|
[self setRead:[[messageInfo objectForKey:MGMIRead] boolValue]];
|
||||||
[self setRead:read];
|
|
||||||
|
|
||||||
BOOL rebuild = [[[[manager themeManager] variant] objectForKey:MGMTRebuild] boolValue];
|
BOOL rebuild = [[[[manager themeManager] variant] objectForKey:MGMTRebuild] boolValue];
|
||||||
BOOL newMessages = NO;
|
BOOL newMessages = NO;
|
||||||
for (unsigned int i=[messages count]; i<[theMessages count]; i++) {
|
for (unsigned int i=[messages count]; i<[theMessages count]; i++) {
|
||||||
newMessages = YES;
|
newMessages = YES;
|
||||||
[messages addObject:[theMessages objectAtIndex:i]];
|
[messages addObject:[theMessages objectAtIndex:i]];
|
||||||
|
if (![[[theMessages objectAtIndex:i] objectForKey:MGMIYou] boolValue])
|
||||||
|
newIncomingMessages = YES;
|
||||||
if (!rebuild)
|
if (!rebuild)
|
||||||
[self addMessage:[messages lastObject]];
|
[self addMessage:[messages lastObject]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newMessages && rebuild)
|
if (newMessages && rebuild)
|
||||||
[self buildHTML];
|
[self buildHTML];
|
||||||
if (!read)
|
if (newIncomingMessages)
|
||||||
[self sendNotifications];
|
[self sendNotifications];
|
||||||
}
|
}
|
||||||
|
return newIncomingMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updatedTheme:(NSNotification *)theNotification {
|
- (void)updatedTheme:(NSNotification *)theNotification {
|
||||||
|
Loading…
Reference in New Issue
Block a user