Prevent dragging groups into groups. Fixes #8706
[adiumx.git] / Source / AIVideoConfController.m
blob024a7feed2d878bcd02e039f4ae49f645987e811
1 /* 
2  * Adium is the legal property of its developers, whose names are listed in the copyright file included
3  * with this source distribution.
4  * 
5  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6  * General Public License as published by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
11  * Public License for more details.
12  * 
13  * You should have received a copy of the GNU General Public License along with this program; if not,
14  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15  */
17 #import "AIVideoConfController.h"
19 #import <AIUtilities/AIToolbarUtilities.h>
20 #import <AIUtilities/AIImageAdditions.h>
21 #import <Adium/AIObject.h>
22 #import <Adium/AIListObject.h>
23 #import <Adium/AIPreferencePane.h>
25 @implementation AIVideoConfController
27 ////////////////////////////////////////////////////////////////////////////////
28 #pragma mark                         Initializers
29 ////////////////////////////////////////////////////////////////////////////////
31 /*!
32  * @brief Initialize
33  */
34 - (id)init
36         if ((self = [super init])) {
37                 providers = [[NSMutableDictionary alloc] init];
38         }
39         
40         return self;
43 /*!
44  * @brief Finish initialization
45  */
46 - (void)controllerDidLoad
48         // Nothing to do...
51 /*!
52  * @brief Close
53  */
54 - (void)controllerWillClose
56         // Nothing to do...
57
59 /*!
60  * @brief Deallocate
61  */
62 - (void)dealloc
64         [providers release]; providers = nil;
65     [super dealloc];
68 ////////////////////////////////////////////////////////////////////////////////
69 #pragma mark                 Protocol Providers Management
70 ////////////////////////////////////////////////////////////////////////////////
72 /*!
73  * @brief Register a protocol provider
74  */
75 - (void) registerProvider:(id)provider forProtocol:(VCProtocol)protocol
77         NSAssert([provider conformsToProtocol:@protocol(VCProtocolProvider)],
78                          @"Protocol does not conform to the VCProtocolProvider protocol.");
80         // Add our new provider
81         [providers setObject:provider forKey:[NSNumber numberWithInt:protocol]];        
84 /*!
85  * @brief Unregister a protocol provider
86  */
87 - (void) unregisterProviderForProtocol:(VCProtocol)protocol
89         [providers removeObjectForKey:[NSNumber numberWithInt:protocol]];
92 /*!
93  * @brief       Return the list of providers for a protocol
94  */
95 - (NSDictionary*) providersForProtocol:(VCProtocol)protocol
97         NSMutableDictionary     *providersSet   = [NSMutableDictionary dictionary];     
98         NSDictionary            *availableProviders;
99         
100         if ((availableProviders = [providers objectForKey:[NSNumber numberWithInt:protocol]])) {
101                 [providersSet addEntriesFromDictionary:availableProviders];
102         }
103         
104         return providersSet;
108 ////////////////////////////////////////////////////////////////////////////////
109 #pragma mark                     Payloads
110 ////////////////////////////////////////////////////////////////////////////////
111 - (NSArray*) getAudioPayloadsForProtocol:(VCProtocol)protocol
113         NSArray                                 *listOfPayloads = nil;
114         id<VCProtocolProvider>   provider;
115         
116         provider = [providers objectForKey:[NSNumber numberWithInt:protocol]];
117         if (provider != nil) {
118                 listOfPayloads = [provider getAudioPayloadsForProtocol:protocol];
119         }
120         
121         return listOfPayloads;  
124 - (NSArray*) getVideoPayloadsForProtocol:(VCProtocol)protocol
126         NSArray                                 *listOfPayloads = nil;
127         id<VCProtocolProvider>   provider;
128         
129         provider = [providers objectForKey:[NSNumber numberWithInt:protocol]];
130         if (provider != nil) {
131                 listOfPayloads = [provider getVideoPayloadsForProtocol:protocol];
132         }
133         
134         return listOfPayloads;
138 ////////////////////////////////////////////////////////////////////////////////
139 #pragma mark                  Connections Creation
140 ////////////////////////////////////////////////////////////////////////////////
141 - (id) createConnectionWithProtocol:(VCProtocol)protocol
142                                                         payload:(VCPayload*)pt 
143                                                            from:(VCTransport*)local
144                                                                  to:(VCTransport*)remote
146         id<VCConnection>                connection = nil;
147         id<VCProtocolProvider>  provider;
148         
149         provider = [providers objectForKey:[NSNumber numberWithInt:protocol]];  
150         if (provider != nil) {
151                 connection = [provider createConnectionWithProtocol:protocol payload:pt from:local to:remote];
152         }
153         
154         return connection;
158 @end