Plugins/Bonjour/libezv/Private Classes/AWEzvContactManagerRendezvous.m
author Thijs Alkemade <me@thijsalkema.de>
Tue, 21 Mar 2017 21:09:53 +0100
branchadium-1.5.10.3
changeset 5956 297f01718b75
parent 5019 89b86d3ffe84
child 6017 489d1e762237
permissions -rw-r--r--
Replaced OpenSSL with Common Crypto for SHA1 in Bonjour.

Fixes #17093
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     1
/*
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     2
 * Project:     Libezv
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     3
 * File:        AWEzvContactManagerRendezvous.m
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     4
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     5
 * Version:     1.0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     6
 * Author:      Andrew Wellington <proton[at]wiretapped.net>
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     7
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     8
 * License:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
     9
 * Copyright (C) 2004-2007 Andrew Wellington.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    10
 * All rights reserved.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    11
 * 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    12
 * Redistribution and use in source and binary forms, with or without
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    13
 * modification, are permitted provided that the following conditions are met:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    14
 * 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    15
 * 1. Redistributions of source code must retain the above copyright notice,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    16
 * this list of conditions and the following disclaimer.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    17
 * 2. Redistributions in binary form must reproduce the above copyright notice,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    18
 * this list of conditions and the following disclaimer in the documentation
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    19
 * and/or other materials provided with the distribution.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    20
 * 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    21
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    22
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    23
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    24
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    25
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    26
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    27
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    28
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    29
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    30
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    31
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    32
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    33
#import "AWEzvContactManager.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    34
#import "AWEzvContactManagerRendezvous.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    35
#import "AWEzv.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    36
#import "AWEzvPrivate.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    37
#import "AWEzvContact.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    38
#import "AWEzvContactPrivate.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    39
#import "AWEzvRendezvousData.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    40
#import "AWEzvSupportRoutines.h"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    41
2093
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    42
#import <dns_sd.h>
5956
297f01718b75 Replaced OpenSSL with Common Crypto for SHA1 in Bonjour.
Thijs Alkemade <me@thijsalkema.de>
parents: 5019
diff changeset
    43
#include <CommonCrypto/CommonDigest.h>
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    44
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    45
/* One of the stupidest things I've ever met. Doing DNS lookups using the standard
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    46
 * functions does not for mDNS records work unless you're in BIND 8 compatibility
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    47
 * mode. And of course how do you get data from say a NULL record for iChat stuff?
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    48
 * With the standard DNS functions. So we have to use BIND 8 mode. Which means we
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    49
 * have to implement our own DNS packet parser. What were people thinking here?
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    50
 */
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    51
#define BIND_8_COMPAT 1
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
    52
2093
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    53
#import <sys/types.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    54
#import <sys/socket.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    55
#import <netinet/in.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    56
#import <arpa/nameser.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    57
#import <arpa/inet.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    58
#import <netdb.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    59
#import <resolv.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    60
#import <errno.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    61
#import <ctype.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    62
#import <string.h>
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    63
#import <stdlib.h>
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    64
2093
d470a05e220b I see no reason to not use #import for everything. Apple's compiler supports it fine in .c files, and it doesn't seem to have any downsides vs #include unless you're playing silly multiple inclusion tricks
David Smith <catfish.man@gmail.com>
parents: 749
diff changeset
    65
#import <SystemConfiguration/SystemConfiguration.h>
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
    66
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    67
// The ServiceController manages cleanup of DNSServiceRef & runloop info for an outstanding request
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    68
@interface ServiceController : NSObject
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    69
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    70
	DNSServiceRef			fServiceRef;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    71
	CFSocketRef				fSocketRef;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    72
	CFRunLoopSourceRef		fRunloopSrc;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    73
	AWEzvContactManager		*contactManager;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    74
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    75
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    76
- (id)initWithServiceRef:(DNSServiceRef)ref forContactManager:(AWEzvContactManager *)inContactManager;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    77
- (boolean_t)addToCurrentRunLoop;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    78
- (void)breakdownServiceController;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    79
- (DNSServiceRef)serviceRef;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
    80
561
56c9e94d32f2 warnings-- and maybe fix a bug
David Smith
parents: 559
diff changeset
    81
@property (readonly, nonatomic) AWEzvContactManager *contactManager;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    82
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
    83
@end // Interface ServiceController
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    84
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
    85
// C-helper function prototypes
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    86
void register_reply ( 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    87
    DNSServiceRef sdRef, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    88
    DNSServiceFlags flags, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    89
    DNSServiceErrorType errorCode, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    90
    const char *name, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    91
    const char *regtype, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    92
    const char *domain, 
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
    93
    void *context
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
    94
);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    95
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    96
static void ProcessSockData (
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    97
   CFSocketRef s,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    98
   CFSocketCallBackType callbackType,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
    99
   CFDataRef address,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   100
   const void *data,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   101
   void *info
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   102
);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   103
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   104
void handle_av_browse_reply ( 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   105
    DNSServiceRef sdRef, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   106
    DNSServiceFlags flags, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   107
    uint32_t interfaceIndex, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   108
    DNSServiceErrorType errorCode, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   109
    const char *serviceName, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   110
    const char *regtype, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   111
    const char *replyDomain, 
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   112
    void *context
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   113
);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   114
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   115
void resolve_reply ( 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   116
    DNSServiceRef sdRef, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   117
    DNSServiceFlags flags, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   118
    uint32_t interfaceIndex, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   119
    DNSServiceErrorType errorCode, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   120
    const char *fullname, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   121
    const char *hosttarget, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   122
    uint16_t port, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   123
    uint16_t txtLen, 
571
891de47cc259 Fix type to match new header, maybe fixing bugs in the process. Done with the bonjour warnings, hooray :)
David Smith
parents: 568
diff changeset
   124
    const unsigned char *txtRecord, 
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   125
    void *context
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   126
);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   127
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   128
void AddressQueryRecordReply(DNSServiceRef DNSServiceRef, DNSServiceFlags flags, uint32_t interfaceIndex, 
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   129
								DNSServiceErrorType errorCode, const char *fullname, uint16_t rrtype, uint16_t rrclass, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   130
								uint16_t rdlen, const void *rdata, uint32_t ttl, void *context );
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   131
								
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   132
void ImageQueryRecordReply(DNSServiceRef DNSServiceRef, DNSServiceFlags flags, uint32_t interfaceIndex, 
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   133
								DNSServiceErrorType errorCode, const char *fullname, uint16_t rrtype, uint16_t rrclass, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   134
								uint16_t rdlen, const void *rdata, uint32_t ttl, void *context );	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   135
								
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   136
void image_register_reply ( 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   137
    DNSServiceRef sdRef, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   138
    DNSRecordRef RecordRef, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   139
    DNSServiceFlags flags, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   140
    DNSServiceErrorType errorCode, 
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   141
    void *context
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   142
);							
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   143
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   144
@implementation AWEzvContactManager (Rendezvous)
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   145
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   146
#pragma mark Announcing Functions
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   147
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   148
- (void) login
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   149
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   150
	regCount = 0;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   151
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   152
	// Create data structure we'll advertise with
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   153
	userAnnounceData = [[AWEzvRendezvousData alloc] init];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   154
	// Set field contents of the data
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   155
	[userAnnounceData setField:@"1st" content:[client name]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   156
	[userAnnounceData setField:@"email" content:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   157
	[userAnnounceData setField:@"ext" content:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   158
	[userAnnounceData setField:@"jid" content:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   159
	[userAnnounceData setField:@"last" content:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   160
	[userAnnounceData setField:@"msg" content:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   161
	[userAnnounceData setField:@"nick" content:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   162
	[userAnnounceData setField:@"node" content:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   163
	[userAnnounceData setField:@"AIM" content:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   164
	[userAnnounceData setField:@"email" content:@""];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   165
	[userAnnounceData setField:@"port.p2pj" content:[NSString stringWithFormat:@"%u", port]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   166
	[userAnnounceData setField:@"txtvers" content:@"1"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   167
	[userAnnounceData setField:@"version" content:@"1"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   168
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   169
	[self setStatus:[client status] withMessage:nil];
2830
c770142607e4 If Bonjour disconnects but the user opens a contact window in the moment before the contact disappears from the list, it wass possible to attempt to open with a nil avInstanceName. Furthermore, if Bonjour disconnects, attempting to send a message to a still-open Bonjour chat could try to reference avInstanceName which would previously be nil after disconnect.
Evan Schoenberg
parents: 2093
diff changeset
   170
	
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   171
    // Register service with mDNSResponder
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   172
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   173
	DNSServiceRef servRef;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   174
	DNSServiceErrorType dnsError;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   175
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   176
	TXTRecordRef txtRecord;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   177
	txtRecord = [userAnnounceData dataAsTXTRecordRef];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   178
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   179
	dnsError = DNSServiceRegister(
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   180
			/* Uninitialized service discovery reference */ &servRef, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   181
		    /* Flags indicating how to handle name conflicts */ /* kDNSServiceFlagsNoAutoRename */ 0, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   182
		    /* Interface on which to register, 0 for all available */ 0, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   183
		    /* Service's name, may be null */ [avInstanceName UTF8String],
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   184
		    /* Service registration type */ "_presence._tcp", 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   185
		    /* Domain, may be NULL */ NULL,
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   186
		    /* SRV target host name, may be NULL */ NULL,
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   187
		    /* Port number in network byte order */ htons(port), 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   188
		    /* Length of txt record in bytes, 0 for NULL txt record */ TXTRecordGetLength(&txtRecord) , 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   189
		    /* Txt record properly formatted, may be NULL */ TXTRecordGetBytesPtr(&txtRecord) ,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   190
		    /* Call back function, may be NULL */ register_reply,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   191
			/* Application context pointer, may be null */ self
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   192
	);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   193
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   194
	if (dnsError == kDNSServiceErr_NoError) {		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   195
		fDomainBrowser = [[ServiceController alloc] initWithServiceRef:servRef forContactManager:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   196
		[fDomainBrowser addToCurrentRunLoop];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   197
		avDNSReference = servRef;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   198
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   199
		[[client client] reportError:@"Could not register DNS service: _presence._tcp" ofLevel:AWEzvConnectionError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   200
		[self disconnect];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   201
	}
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   202
407
eb6ebb0ec42b Fix leaks
David Smith
parents: 0
diff changeset
   203
	TXTRecordDeallocate(&txtRecord);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   204
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   205
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   206
// This is used for a clean logout
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   207
- (void) logout
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   208
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   209
    [self disconnect];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   210
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   211
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   212
// This causes an actual disconnect
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   213
- (void) disconnect
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   214
{
3380
0157dd58ad43 Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3088
diff changeset
   215
	AILogWithSignature(@"isDisconnecting");
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   216
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   217
	[fServiceBrowser release]; fServiceBrowser = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   218
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   219
	// Remove Resolvers, this also deallocates the DNSServiceReferences
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   220
	if (fDomainBrowser != nil) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   221
		AILogWithSignature(@"Releasing %@",fDomainBrowser);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   222
		[fDomainBrowser release]; fDomainBrowser = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   223
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   224
		avDNSReference = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   225
		imageServiceRef = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   226
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   227
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   228
	[self setConnected:NO];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   229
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   230
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   231
- (void) setConnected:(BOOL)connected
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   232
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   233
	if (isConnected != connected) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   234
		isConnected = connected;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   235
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   236
		if (connected) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   237
			[[client client] reportLoggedIn];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   238
		} else {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   239
			[[client client] reportLoggedOut];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   240
		}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   241
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   242
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   243
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   244
- (void)setStatus:(AWEzvStatus)status withMessage:(NSString *)message
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   245
{
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   246
	NSString *statusString; // String for use in Rendezous field
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   247
	// Work out the string for rendezvous
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   248
	switch (status) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   249
		case AWEzvIdle:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   250
			statusString = @"away";
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   251
	    	break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   252
		case AWEzvAway:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   253
			statusString = @"dnd";
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   254
			break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   255
		case AWEzvOnline:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   256
			statusString = @"avail";
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   257
			break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   258
		default:
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   259
	    	// If something weird, default to available
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   260
			statusString = @"avail";
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   261
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   262
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   263
	// Add it to our data
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   264
	[userAnnounceData setField:@"status" content:statusString];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   265
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   266
	// Now set the message
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   267
	if ([message length]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   268
		[userAnnounceData setField:@"msg" content:message];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   269
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   270
		[userAnnounceData deleteField:@"msg"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   271
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   272
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   273
	// Check for idle
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   274
	if ([client idleTime]) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   275
		[userAnnounceData setField:@"away" content:[NSString stringWithFormat:@"%f", [[client idleTime] timeIntervalSinceReferenceDate]]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   276
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   277
		[userAnnounceData deleteField:@"away"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   278
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   279
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   280
	// Announce to network
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   281
	if (isConnected == YES) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   282
		[self updateAnnounceInfo];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   283
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   284
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   285
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   286
// Udpates information announced over network for user
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   287
- (void) updateAnnounceInfo
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   288
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   289
	DNSServiceErrorType updateError;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   290
	TXTRecordRef txtRecord;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   291
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   292
	if (!isConnected) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   293
		return;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   294
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   295
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   296
	if (avDNSReference == NULL) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   297
		[[client client] reportError:@"avDNSReference is null when trying to update the TXT Record" ofLevel:AWEzvWarning];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   298
		return;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   299
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   300
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   301
	txtRecord = [userAnnounceData dataAsTXTRecordRef];
663
3500b2c012a7 Some debug logging in this broken code
Evan Schoenberg
parents: 571
diff changeset
   302
	AILogWithSignature(@"%@", [userAnnounceData dictionary]);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   303
	updateError = DNSServiceUpdateRecord (
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   304
		/* serviceRef */ avDNSReference,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   305
		/* recordRef, may be NULL */ NULL,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   306
		/* Flags, currently ignored */ 0,
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   307
		/* length */ TXTRecordGetLength(&txtRecord),
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   308
		/* data */ TXTRecordGetBytesPtr(&txtRecord),
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   309
		/* time to live */ 0
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   310
	);
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   311
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   312
	if (updateError != kDNSServiceErr_NoError) {		
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   313
		[[client client] reportError:@"Error updating TXT Record" ofLevel:AWEzvConnectionError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   314
		[self disconnect];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   315
	}
407
eb6ebb0ec42b Fix leaks
David Smith
parents: 0
diff changeset
   316
	
eb6ebb0ec42b Fix leaks
David Smith
parents: 0
diff changeset
   317
	TXTRecordDeallocate(&txtRecord);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   318
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   319
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   320
- (void) updatedName
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   321
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   322
	[userAnnounceData setField:@"1st" content:[client name]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   323
	[self updateAnnounceInfo];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   324
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   325
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   326
- (void) updatedStatus
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   327
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   328
	[self setStatus:[client status] withMessage:[userAnnounceData getField:@"msg"]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   329
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   330
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   331
- (void)setImageData:(NSData *)JPEGData
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   332
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   333
	DNSServiceErrorType error;
5956
297f01718b75 Replaced OpenSSL with Common Crypto for SHA1 in Bonjour.
Thijs Alkemade <me@thijsalkema.de>
parents: 5019
diff changeset
   334
	unsigned char digest[CC_SHA1_DIGEST_LENGTH];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   335
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   336
	if (avDNSReference == NULL) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   337
		[[client client] reportError:@"Error setting image data" ofLevel:AWEzvWarning];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   338
		return;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   339
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   340
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   341
	if (JPEGData == nil) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   342
		// No image so remove record and update txt records
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   343
		error = DNSServiceRemoveRecord ( 
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   344
		    /* Service reference */ avDNSReference, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   345
		    /* Record reference */ imageRef, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   346
		    /* Flags, ignored */ 0);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   347
		if (error == kDNSServiceErr_NoError) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   348
			imageRef = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   349
			[userAnnounceData deleteField:@"phsh"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   350
			[self updateAnnounceInfo];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   351
			return;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   352
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   353
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   354
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   355
	if (imageRef != nil && JPEGData != nil) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   356
		/* Remove the old reference before updating the image. 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   357
		 * This works around a bug experienced when updating the record to use an image that occupied more space
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   358
		 */
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   359
		error = DNSServiceRemoveRecord ( 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   360
		    /* service reference */ /*imageServiceRef*/avDNSReference, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   361
		    /* record reference */ imageRef, 
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   362
			/* flags, ignored */ 1
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   363
		);
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   364
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   365
		if (error != kDNSServiceErr_NoError) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   366
			[[client client] reportError:@"Error removing old image before setting new image" ofLevel:AWEzvWarning];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   367
			return;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   368
		} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   369
			[userAnnounceData deleteField:@"phsh"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   370
			imageRef = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   371
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   372
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   373
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   374
	error = DNSServiceAddRecord (/* Service reference */ avDNSReference, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   375
	                             /* Record reference */ &imageRef, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   376
	                             /* Flags, ignored */ 0, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   377
	                             /* Type */ kDNSServiceType_NULL, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   378
	                             /* Length */ [JPEGData length], 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   379
	                             /* Data */ [JPEGData bytes], 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   380
	                             /* Time to live; 0 = default */ 0);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   381
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   382
	if (error == kDNSServiceErr_NoError) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   383
		// Let's create the hash
5956
297f01718b75 Replaced OpenSSL with Common Crypto for SHA1 in Bonjour.
Thijs Alkemade <me@thijsalkema.de>
parents: 5019
diff changeset
   384
		CC_SHA1([JPEGData bytes], (CC_LONG)[JPEGData length], digest);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   385
		imagehash = [[NSData dataWithBytes:digest length:20] retain];
663
3500b2c012a7 Some debug logging in this broken code
Evan Schoenberg
parents: 571
diff changeset
   386
		AILogWithSignature(@"Will update with hash %@; length is %u", imagehash, [JPEGData length]);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   387
		[self updatePHSH];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   388
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   389
		[[client client] reportError:@"Error adding image record" ofLevel:AWEzvWarning];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   390
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   391
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   392
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   393
- (void) updatePHSH
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   394
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   395
	if (imagehash != nil) {
407
eb6ebb0ec42b Fix leaks
David Smith
parents: 0
diff changeset
   396
		[userAnnounceData setField:@"phsh" content:[imagehash autorelease]];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   397
		// Announce to network
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   398
		[self updateAnnounceInfo];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   399
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   400
		[userAnnounceData deleteField:@"phsh"];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   401
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   402
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   403
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   404
#pragma mark Browsing Functions
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   405
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   406
// Start browsing the network for new rendezvous clients
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   407
- (void) startBrowsing
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   408
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   409
	[fServiceBrowser release]; fServiceBrowser = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   410
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   411
	// Destroy old contact dictionary if one exists
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   412
	[contacts release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   413
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   414
	// Allocate new contact dictionary
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   415
	contacts = [[NSMutableDictionary alloc] init];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   416
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   417
	// Create AV browser
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   418
	DNSServiceRef browsRef;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   419
	DNSServiceErrorType avBrowseError;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   420
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   421
	avBrowseError = DNSServiceBrowse (/* Uninitialized DNSServiceRef */ &browsRef,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   422
	                                  /* Flags, currently unused */ 0,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   423
	                                  /* Interface index, 0 for all available */ 0,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   424
	                                  /* Registration type */ "_presence._tcp",
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   425
	                                  /* Domain, may be null for default */ NULL,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   426
	                                  /* CallBack function */ handle_av_browse_reply,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   427
	                                  /* Context, may be null */ self);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   428
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   429
	if (avBrowseError == kDNSServiceErr_NoError) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   430
		fServiceBrowser = [[ServiceController alloc] initWithServiceRef:browsRef forContactManager:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   431
		[fServiceBrowser addToCurrentRunLoop];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   432
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   433
		[[client client] reportError:@"Could not browse for _presence._tcp instances" ofLevel:AWEzvConnectionError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   434
		[self disconnect];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   435
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   436
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   437
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   438
// Stop looking for new rendezvous clients
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   439
- (void)stopBrowsing
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   440
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   441
	AILogWithSignature(@"fServiceBrowser is %@ (retain count %i)", fServiceBrowser, [fServiceBrowser retainCount]);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   442
	[fServiceBrowser release]; fServiceBrowser = nil;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   443
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   444
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   445
// Handle a message from our browser
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   446
- (void)browseResultwithFlags:(DNSServiceFlags)flags
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   447
				  onInterface:(uint32_t) interfaceIndex
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   448
						 name:(const char *)replyName
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   449
						 type:(const char *)replyType
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   450
					   domain:(const char *)replyDomain
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   451
						   av:(BOOL) av
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   452
{	
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   453
	AWEzvContact *contact;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   454
	
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   455
	if (!replyName) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   456
		return;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   457
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   458
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   459
	NSString *replyNameString = [NSString stringWithUTF8String:replyName];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   460
	
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   461
	if (!replyNameString) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   462
		return;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   463
	}
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   464
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   465
	if (flags == (kDNSServiceFlagsAdd) || flags == (kDNSServiceFlagsMoreComing | kDNSServiceFlagsAdd)) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   466
		// Add this contact
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   467
		// Initialise contact
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   468
		contact = [[AWEzvContact alloc] init];
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   469
		contact.uniqueID = replyNameString;
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   470
		contact.manager = self;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   471
		// Save contact in dictionary
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   472
		[contacts setObject:contact forKey:replyNameString];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   473
		[contact autorelease];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   474
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   475
		// Resolve contact
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   476
		DNSServiceRef resolveRef;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   477
		DNSServiceErrorType resolveRefError;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   478
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   479
		resolveRefError = DNSServiceResolve (
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   480
			/* Serviceref uninitialized */ &resolveRef,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   481
			/* Flags, currently ignored */ 0,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   482
			/* InterfaceIndex */ 0,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   483
			/* Full name */ replyName,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   484
			/* Registration type */ "_presence._tcp" /* replyType */,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   485
			/* Domain */ replyDomain,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   486
			/* Callback */ resolve_reply,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   487
			/* Contxt, may be NULL */ contact
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   488
		);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   489
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   490
		if (resolveRefError == kDNSServiceErr_NoError) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   491
			ServiceController *serviceResolver = [[ServiceController alloc] initWithServiceRef:resolveRef forContactManager:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   492
			[contact setResolveServiceController:serviceResolver];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   493
			[[contact resolveServiceController] addToCurrentRunLoop];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   494
			[serviceResolver release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   495
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   496
		} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   497
			[[client client] reportError:@"Could not search for TXT records" ofLevel:AWEzvConnectionError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   498
			[self disconnect];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   499
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   500
	} else {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   501
		// Delete the contact
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   502
		contact = [contacts objectForKey:replyNameString];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   503
		
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   504
		if (!contact) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   505
			return;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   506
		}
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   507
		
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   508
		[[client client] userLoggedOut:contact];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   509
		// Remove the contact from our data structures
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   510
		[contacts removeObjectForKey:replyNameString];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   511
		return;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   512
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   513
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   514
- (void)findAddressForContact:(AWEzvContact *)contact
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   515
					 withHost:(NSString *)host
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   516
				withInterface:(uint32_t)interface
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   517
{
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   518
	// Now we need to query the record for the ip address
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   519
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   520
	DNSServiceErrorType err;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   521
	DNSServiceRef		serviceRef;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   522
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   523
	err = DNSServiceQueryRecord( &serviceRef, (DNSServiceFlags) 0, interface, [host UTF8String], 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   524
	                             kDNSServiceType_A, kDNSServiceClass_IN, AddressQueryRecordReply, contact);
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   525
	
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   526
	if (err == kDNSServiceErr_NoError) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   527
		ServiceController *temp = [[ServiceController alloc] initWithServiceRef:serviceRef forContactManager:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   528
		[contact setAddressServiceController:temp];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   529
		[[contact addressServiceController] addToCurrentRunLoop];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   530
		[temp release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   531
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   532
		[[client client] reportError:@"Error finding adress for contact" ofLevel:AWEzvError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   533
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   534
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   535
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   536
- (void)updateAddressForContact:(AWEzvContact *)contact
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   537
						   addr:(const void *)buff
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   538
						addrLen:(uint16_t)addrLen
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   539
						   host:(const char*) host
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   540
				 interfaceIndex:(uint32_t)interface
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   541
						   more:(boolean_t)moreToCome
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   542
{
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   543
	// Check that contact exists in dictionary
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   544
	if ([contacts objectForKey:contact.uniqueID] == nil) {
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   545
		NSString *uniqueID = contact.uniqueID;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   546
		// So they haven't been seen before... not to worry we'll add them
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   547
		if (contact.uniqueID != nil) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   548
			contact = [[AWEzvContact alloc] init];
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   549
			contact.uniqueID = uniqueID;
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   550
			contact.manager = self;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   551
			// Save contact in dictionary
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   552
			[contacts setObject:contact forKey:contact.uniqueID];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   553
			[contact autorelease];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   554
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   555
		} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   556
			[[client client] reportError:@"Contact to update not in dictionary and has bad identifier" ofLevel:AWEzvError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   557
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   558
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   559
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   560
	NSString *ipAddr;	// IP address of contact
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   561
	NSRange	range;		// Just a range...
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   562
    
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   563
	char addrBuff[256];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   564
	
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   565
	inet_ntop( AF_INET, buff, addrBuff, sizeof addrBuff);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   566
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   567
	ipAddr = [NSString stringWithCString:addrBuff encoding:NSUTF8StringEncoding];
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   568
	range = [ipAddr rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@":"]];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   569
	
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   570
	if (range.location == NSNotFound) {
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   571
		contact.ipAddr = ipAddr;
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   572
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   573
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   574
	if (!contact.ipAddr || !contact.ipAddr.length) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   575
		[[client client] reportError:@"ip address not set" ofLevel:AWEzvError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   576
		[contact setStatus: AWEzvUndefined];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   577
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   578
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   579
	if (!moreToCome) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   580
		[contact setAddressServiceController: nil];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   581
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   582
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   583
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   584
- (void)updateImageForContact:(AWEzvContact *)contact
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   585
						 data:(const void *)data
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   586
					  dataLen:(uint16_t)dataLen
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   587
						 more:(boolean_t)moreToCome
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   588
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   589
	if (!moreToCome) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   590
		[contact setImageServiceController: nil];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   591
	}
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   592
	
663
3500b2c012a7 Some debug logging in this broken code
Evan Schoenberg
parents: 571
diff changeset
   593
	AILogWithSignature(@"%@ -> %@ (%i)", [NSData dataWithBytes:data length:dataLen], [[[NSImage alloc] initWithData:[NSData dataWithBytes:data length:dataLen]] autorelease], dataLen);
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   594
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   595
	if (dataLen != 0 ) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   596
		// We have an image
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   597
		// Parse raw Data
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   598
		[contact setContactImageData:[NSData dataWithBytes:data length:dataLen]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   599
	    [[client client] userChangedImage:contact];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   600
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   601
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   602
		[contact setImageHash: NULL];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   603
		[[client client] reportError:@"Error retrieving picture" ofLevel:AWEzvError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   604
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   605
}
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   606
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   607
- (void)updateContact:(AWEzvContact *)contact
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   608
			 withData:(AWEzvRendezvousData *)rendezvousData
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   609
			 withHost:(NSString *)host
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   610
		withInterface:(uint32_t)interface
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   611
			 withPort:(uint16_t)recPort
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   612
				   av:(BOOL)av
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   613
{
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   614
	NSString		*nick = nil;			// Nickname for contact
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   615
	NSMutableString	*mutableNick = nil;		// Nickname we can modify
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   616
	AWEzvRendezvousData	*oldrendezvous;		// XXX not used - Old rendezvous data for user
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   617
	NSNumber           *idleTime = nil;		// Idle time
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   618
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   619
	// Check that contact exists in dictionary
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   620
	if ([contacts objectForKey:contact.uniqueID] == nil) {
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   621
		NSString *uniqueID = contact.uniqueID;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   622
		// So they haven't been seen before... not to worry we'll add them
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   623
		if (contact.uniqueID != nil) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   624
			contact = [[AWEzvContact alloc] init];
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   625
			contact.uniqueID = uniqueID;
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   626
			contact.manager = self;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   627
			// Save contact in dictionary
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   628
			[contacts setObject:contact forKey:contact.uniqueID];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   629
			[contact autorelease];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   630
		} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   631
			[[client client] reportError:@"Contact to update not in dictionary and has bad identifier" ofLevel:AWEzvError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   632
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   633
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   634
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   635
	if ([rendezvousData getField:@"slumming"] != nil) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   636
		// We don't want to live in a slum
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   637
		return;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   638
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   639
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   640
	if ([contact rendezvous] != nil) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   641
		oldrendezvous = [contact rendezvous];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   642
		// Check serials
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   643
		if ([contact serial] > [contact serial]) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   644
			// AWEzvLog(@"Rendezvous update for %@ with lower serial, updating anyway", contact.uniqueID);
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   645
			// We'll update anyway, and hopefully we'll be back in sync with the network
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   646
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   647
	}
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   648
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   649
	[contact setRendezvous:rendezvousData];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   650
	
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   651
	// Now we can update the contact
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   652
	// Get the nickname
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   653
	if ([rendezvousData getField:@"1st"] != nil) {
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   654
		nick = [rendezvousData getField:@"1st"];
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   655
	}
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   656
	
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   657
	if ([rendezvousData getField:@"last"] != nil) {
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   658
		if (nick == nil) {
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   659
			nick = [rendezvousData getField:@"last"];
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   660
		} else {
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   661
			mutableNick = [[nick mutableCopy] autorelease];
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   662
			[mutableNick appendString:@" "];
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   663
			[mutableNick appendString:[rendezvousData getField:@"last"]];
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   664
			nick = [[mutableNick copy] autorelease];
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   665
		}
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   666
	} else if (nick == nil) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   667
	    nick = @"Unnamed contact";
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   668
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   669
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   670
	[contact setName:nick];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   671
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   672
	// Now get the status
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   673
	if ([rendezvousData getField:@"status"] == nil) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   674
		[contact setStatus: AWEzvOnline];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   675
	} else {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   676
		if ([[rendezvousData getField:@"status"] isEqualToString:@"avail"]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   677
			[contact setStatus: AWEzvOnline];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   678
		} else if ([[rendezvousData getField:@"status"] isEqualToString:@"dnd"]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   679
			[contact setStatus: AWEzvAway];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   680
		} else if ([[rendezvousData getField:@"status"] isEqualToString:@"away"]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   681
			[contact setStatus: AWEzvIdle];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   682
		} else {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   683
			[contact setStatus: AWEzvOnline];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   684
		}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   685
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   686
	
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   687
	// Set idle time
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   688
	if ([rendezvousData getField:@"away"]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   689
		idleTime = [NSNumber numberWithLong:strtol([[rendezvousData getField:@"away"] UTF8String], NULL, 0)];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   690
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   691
	
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   692
	if (idleTime) {
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   693
		[contact setIdleSinceDate: [NSDate dateWithTimeIntervalSinceReferenceDate:[idleTime doubleValue]]];
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   694
	}
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   695
	
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   696
	// Update Buddy Icon
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   697
	if ([rendezvousData getField:@"phsh"] != nil) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   698
		// We should check to see if this is a new phsh
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   699
		NSString *hash = [contact imageHash];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   700
		NSString *newHash = [rendezvousData getField:@"phsh"];
663
3500b2c012a7 Some debug logging in this broken code
Evan Schoenberg
parents: 571
diff changeset
   701
		AILogWithSignature(@"received image hash %@ for %@", newHash, contact);
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   702
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   703
		if (hash == NULL || [newHash compare: hash] != NSOrderedSame) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   704
			[contact setImageHash: newHash];	
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   705
			// The two hashes are different or there was no image before so there is an image to be downloaded
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   706
			// Download the image using DNSServiceQueryRecord
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   707
			DNSServiceErrorType err;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   708
			DNSServiceRef		serviceRef;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   709
749
59409af2f68b Clean up/propertyize some bonjour stuff
David Smith
parents: 663
diff changeset
   710
			NSString *dnsname = [NSString stringWithFormat:@"%@%s", contact.uniqueID,"._presence._tcp.local."];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   711
			err = DNSServiceQueryRecord( &serviceRef, (DNSServiceFlags) 0, interface, [dnsname UTF8String], 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   712
			                            kDNSServiceType_NULL, kDNSServiceClass_IN, ImageQueryRecordReply, contact);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   713
			if ( err == kDNSServiceErr_NoError) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   714
				ServiceController *temp = [[ServiceController alloc] initWithServiceRef:serviceRef forContactManager:self];
663
3500b2c012a7 Some debug logging in this broken code
Evan Schoenberg
parents: 571
diff changeset
   715
				AILogWithSignature(@"requesting image with %@", temp);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   716
				[contact setImageServiceController:temp];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   717
				[[contact imageServiceController] addToCurrentRunLoop];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   718
				[temp release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   719
			} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   720
				[contact setImageHash: NULL];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   721
				[[client client] reportError:@"Error finding image for contact" ofLevel:AWEzvError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   722
			}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   723
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   724
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   725
		[contact setContactImageData:nil];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   726
		[[client client] userChangedImage:contact];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   727
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   728
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   729
	// Now set the port
561
56c9e94d32f2 warnings-- and maybe fix a bug
David Smith
parents: 559
diff changeset
   730
	if (recPort == 0) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   731
		// Couldn't find port from browse result so use port specified by txt records
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   732
		if ([rendezvousData getField:@"port.p2pj"] == nil) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   733
			[[client client] reportError:@"Invalid rendezvous announcement for contact: no port specified" ofLevel:AWEzvError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   734
			return;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   735
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   736
		[contact setPort:[[rendezvousData getField:@"port.p2pj"] intValue]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   737
	} else {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   738
		// Correctly use port specified by SRV record
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   739
		[contact setPort:recPort];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   740
	}
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   741
	// Notify of new user
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   742
	[[client client] userChangedState:contact];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   743
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   744
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   745
- (NSString *)myInstanceName
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   746
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   747
	return avInstanceName;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   748
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   749
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   750
- (void)setInstanceName:(NSString *)newName
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   751
{
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   752
	if (avInstanceName != newName) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   753
		[avInstanceName release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   754
		avInstanceName = [newName retain];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   755
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   756
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   757
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   758
- (void) regCallBack:(int)errorCode
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   759
{
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   760
	// Recover if there was an error
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   761
    if (errorCode != kDNSServiceErr_NoError) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   762
		switch (errorCode) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   763
#warning Localize and report through the connection error system
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   764
			case kDNSServiceErr_Unknown:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   765
				[[[self client] client] reportError:@"Unknown error in Bonjour Registration"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   766
						        ofLevel:AWEzvConnectionError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   767
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   768
			case kDNSServiceErr_NameConflict:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   769
				[[[self client] client] reportError:@"A user with your Bonjour data is already online"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   770
						        ofLevel:AWEzvConnectionError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   771
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   772
			default:
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   773
				[[[self client] client] reportError:@"An internal error occurred"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   774
						        ofLevel:AWEzvConnectionError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   775
				AWEzvLog(@"Internal error: rendezvous code %d", errorCode);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   776
				break;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   777
		}
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   778
		// Kill connections
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   779
		[self disconnect];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   780
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   781
		[self setConnected:YES];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   782
		[self startBrowsing];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   783
	}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   784
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   785
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   786
- (void)contactWillDeallocate:(AWEzvContact *)contact
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   787
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   788
	[[client client] userLoggedOut:contact];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   789
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   790
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   791
- (void)serviceControllerReceivedFatalError:(ServiceController *)serviceController
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   792
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   793
	[[[self client] client] reportError:@"An unrecoverable connection error occurred"
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   794
						        ofLevel:AWEzvConnectionError];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   795
	[self disconnect];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   796
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   797
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   798
@end
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   799
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   800
#pragma mark mDNS Callbacks
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   801
#pragma mark mDNS Register Callbacks
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   802
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   803
void register_reply(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain, void *context)
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   804
{
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   805
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   806
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   807
	AWEzvContactManager *self = context;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   808
	[self setInstanceName:[NSString stringWithUTF8String:name]];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   809
	[self regCallBack:errorCode];
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   810
	
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   811
	[pool release];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   812
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   813
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   814
void image_register_reply( 
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   815
	DNSServiceRef sdRef, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   816
	DNSRecordRef RecordRef, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   817
	DNSServiceFlags flags, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   818
	DNSServiceErrorType errorCode, 
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   819
	void *context)
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   820
{
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   821
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   822
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   823
	if (errorCode != kDNSServiceErr_NoError) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   824
		AWEzvLog(@"error %d registering image record", errorCode);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   825
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   826
		AWEzvContactManager *self = context;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   827
		[self updatePHSH];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   828
	}
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   829
	
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   830
	[pool release];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   831
}
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   832
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   833
#pragma mark mDNS Browse Callback
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   834
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   835
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   836
 * @brief DNSServiceBrowse callback
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   837
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   838
 * This may be called multiple times for a single use of DNSServiceBrowse().
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   839
 */
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   840
void handle_av_browse_reply(DNSServiceRef sdRef,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   841
							DNSServiceFlags flags,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   842
							uint32_t interfaceIndex,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   843
							DNSServiceErrorType errorCode,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   844
							const char *serviceName,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   845
							const char *regtype,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   846
							const char *replyDomain,
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   847
							void *context)
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   848
{
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   849
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   850
	
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   851
	// Received a browser reply from DNSServiceBrowse for av, now must handle processing the list of results
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   852
	if (errorCode == kDNSServiceErr_NoError) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   853
		AWEzvContactManager *self = context;
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   854
	    if (![[self myInstanceName] isEqualToString:[NSString stringWithUTF8String:serviceName]]) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   855
			[self browseResultwithFlags:flags onInterface:interfaceIndex name:serviceName type:regtype domain:replyDomain av:YES];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   856
		}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   857
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   858
		AWEzvLog(@"Error browsing");
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   859
	}
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   860
	
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   861
	[pool release];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   862
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   863
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   864
#pragma mark mDNS Resolve Callback
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   865
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   866
/*!
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   867
* @brief DNSServiceResolve callback
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   868
 *
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   869
 * This may be called multiple times for a single use of DNSServiceResolve().
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   870
 */
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   871
void resolve_reply( DNSServiceRef sdRef, 
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   872
					DNSServiceFlags flags, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   873
					uint32_t interfaceIndex, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   874
					DNSServiceErrorType errorCode, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   875
					const char *fullname, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   876
					const char *hosttarget, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   877
					uint16_t port, 
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   878
					uint16_t txtLen, 
571
891de47cc259 Fix type to match new header, maybe fixing bugs in the process. Done with the bonjour warnings, hooray :)
David Smith
parents: 568
diff changeset
   879
					const unsigned char *txtRecord, 
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   880
					void *context)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   881
{
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   882
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   883
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   884
	if (errorCode == kDNSServiceErr_NoError) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   885
		// Use TXTRecord methods to resolve this
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   886
		AWEzvContact	*contact = context;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   887
		AWEzvContactManager *self = [contact manager];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   888
		// AWEzvLog(@"Would update contact");
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   889
		AWEzvRendezvousData *data;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   890
		data = [[[AWEzvRendezvousData alloc] initWithTXTRecordRef:txtRecord length:txtLen] autorelease];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   891
		[self findAddressForContact:contact withHost:[NSString stringWithUTF8String:hosttarget] withInterface:interfaceIndex];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   892
		[self updateContact:contact withData:data withHost:[NSString stringWithUTF8String:hosttarget] withInterface:interfaceIndex withPort:ntohs(port) av:YES];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   893
	} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   894
		AWEzvLog(@"Error resolving records");
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   895
	}
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   896
	
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   897
	[pool release];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   898
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   899
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   900
#pragma mark mDNS Address Callback
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   901
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   902
void AddressQueryRecordReply(DNSServiceRef serviceRef, DNSServiceFlags flags, uint32_t interfaceIndex, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   903
							DNSServiceErrorType errorCode, const char *fullname, uint16_t rrtype, uint16_t rrclass, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   904
							uint16_t rdlen, const void *rdata, uint32_t ttl, void *context )
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   905
// DNSServiceQueryRecord callback used to look up IP addresses.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   906
{
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   907
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   908
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   909
	AWEzvContact	*contact = context;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   910
	AWEzvContactManager *self = [contact manager];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   911
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   912
	[self updateAddressForContact:contact addr:rdata addrLen:rdlen host:fullname interfaceIndex:interfaceIndex
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   913
							 more:((flags & kDNSServiceFlagsMoreComing) != 0)];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   914
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   915
	[pool release];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   916
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   917
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   918
#pragma mark mDNS Image Callback
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   919
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   920
void ImageQueryRecordReply(DNSServiceRef serviceRef, DNSServiceFlags flags, uint32_t interfaceIndex, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   921
							DNSServiceErrorType errorCode, const char *fullname, uint16_t rrtype, uint16_t rrclass, 
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   922
							uint16_t rdlen, const void *rdata, uint32_t ttl, void *context)
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   923
// DNSServiceQueryRecord callback used to look up buddy icon.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   924
{
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   925
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   926
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   927
	AWEzvContact	*contact = context;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   928
	AWEzvContactManager *self = [contact manager];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   929
	if (errorCode == kDNSServiceErr_NoError) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   930
		if (flags & kDNSServiceFlagsAdd) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   931
			[self updateImageForContact:contact data:rdata dataLen:rdlen more:((flags & kDNSServiceFlagsMoreComing) != 0)];
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   932
		}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   933
	}
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   934
	
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   935
	[pool release];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   936
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   937
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   938
#pragma mark Service Controller
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   939
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   940
// ServiceController was taken from Apple's DNSServiceBrowser.m
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   941
@implementation ServiceController : NSObject
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   942
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   943
#pragma mark CFSocket Callback
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   944
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   945
// This code was taken from Apple's DNSServiceBrowser.m
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   946
static void	ProcessSockData( CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info)
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   947
// CFRunloop callback that notifies dns_sd when new data appears on a DNSServiceRef's socket.
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   948
{
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   949
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   950
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   951
	ServiceController *self = (ServiceController *)info;
663
3500b2c012a7 Some debug logging in this broken code
Evan Schoenberg
parents: 571
diff changeset
   952
	AILogWithSignature(@"Processing result for %@", self);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   953
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   954
	DNSServiceErrorType err = DNSServiceProcessResult([self serviceRef]);
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   955
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   956
	if (err != kDNSServiceErr_NoError) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   957
		if ((err == kDNSServiceErr_Unknown) && !data) {
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   958
			// Try to accept(2) a connection. May be the cause of a hang on Tiger; see #7887.
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   959
			int socketFD = CFSocketGetNative(s);
565
ae6f31197be1 More warnings fixes
David Smith
parents: 561
diff changeset
   960
			int childFD = accept(socketFD, /*addr*/ NULL, /*addrlen*/ NULL);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   961
			AILog(@"%@: Service ref %p received an unknown error with no data; perhaps mDNSResponder crashed? Result of calling accept(2) on fd %d is %d; will disconnect with error",
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   962
				  self, [self serviceRef], socketFD, childFD);
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   963
			// We don't actually *want* a connection, so close the socket immediately.
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   964
			if (childFD > -1) {
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   965
				close(childFD);
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   966
			}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   967
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   968
			[self retain];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   969
			[[self contactManager] serviceControllerReceivedFatalError:self];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   970
			[self breakdownServiceController];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   971
			[self release];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   972
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   973
		} else {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   974
			AILog(@"DNSServiceProcessResult() for socket descriptor %d returned an error! %d with CFSocketCallBackType %d and data %s\n",
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   975
			DNSServiceRefSockFD(info), err, type, data);
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   976
		}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   977
	}
5019
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   978
	
89b86d3ffe84 Add autorelease pools to all AWEzvContactManagerRendezvous' C-callbacks.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 4897
diff changeset
   979
	[pool release];
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   980
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   981
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   982
- (id) initWithServiceRef:(DNSServiceRef) ref forContactManager:(AWEzvContactManager *)inContactManager
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   983
{
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   984
	if ((self = [super init])) {
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   985
		fServiceRef = ref;
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   986
		contactManager = [inContactManager retain];
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   987
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   988
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   989
	return self;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   990
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   991
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   992
- (boolean_t) addToCurrentRunLoop
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   993
// Add the service to the current runloop. Returns non-zero on success.
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   994
{
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   995
	CFSocketContext	ctx = { 1, self, NULL, NULL, NULL };
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   996
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   997
	fSocketRef = CFSocketCreateWithNative(kCFAllocatorDefault, DNSServiceRefSockFD(fServiceRef),
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
   998
										kCFSocketReadCallBack, ProcessSockData, &ctx);
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
   999
	if (fSocketRef != NULL) {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1000
		fRunloopSrc = CFSocketCreateRunLoopSource(kCFAllocatorDefault, fSocketRef, 1);
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
  1001
	}
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
  1002
	
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1003
	if (fRunloopSrc != NULL) {
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1004
		AILogWithSignature(@"Adding run loop source %p from run loop %p", fRunloopSrc, CFRunLoopGetCurrent());
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1005
		CFRunLoopAddSource(CFRunLoopGetCurrent(), fRunloopSrc, kCFRunLoopDefaultMode);
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
  1006
	} else {
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1007
		AILog(@"%@: Could not listen to runloop socket", self);
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
  1008
	}
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1009
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1010
	return (fRunloopSrc != NULL);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1011
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1012
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1013
- (DNSServiceRef) serviceRef
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1014
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1015
	return fServiceRef;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1016
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1017
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1018
- (AWEzvContactManager *)contactManager
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1019
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1020
	return contactManager;
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1021
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1022
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1023
- (void) dealloc
4554
ae6db8e450de Fix initWithServiceRef, minor clean-up. AWEzvContactManagerRendezvous.
Adrian Godoroja <robotive@me.com>
parents: 3380
diff changeset
  1024
// Remove service from runloop, deallocate service and associated resources
0
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1025
{
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1026
	AILogWithSignature(@"%@", self);
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1027
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1028
	[self breakdownServiceController];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1029
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1030
	[super dealloc];
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff changeset
  1031
}
e22ad6bc8b46 svn 1.5 merge tracking is terrible. This is a manual merge of the Sparkle 1.5 branch into trunk
David Smith
parents:
diff