//
//  ServersDataSource.m
//  CyTV Client
//
//  Created by Andreas Junghans on 13.05.05.
//  Copyright 2005 __MyCompanyName__. All rights reserved.
//

#import "ServersDataSource.h"
#import "RendezvousClient.h"


@implementation ServersDataSource

- (id)init {
    if (self = [super init]) {
        _servers = [[NSArray array] retain];
        return self;
    }
    return nil;    
}

- (void)setServers:(NSArray *)servers {
    [_servers autorelease];
    _servers = [servers retain];
}

- (int)numberOfRowsInTableView:(NSTableView *)aTableView {
    return [_servers count];
}

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex {
    return [RendezvousClient getDisplayNameOfService:[_servers objectAtIndex:rowIndex]];
}

- (NSString *)addressForRow:(int)row {
    return [RendezvousClient getAddressOfService:[_servers objectAtIndex:row]];
}

@end
