aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/protocol/irc/IrcAccountID.java
blob: a8f5d2671d79a19abe51d4f69664463c3a9acdf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.protocol.irc;

import net.java.sip.communicator.service.protocol.*;

import java.util.Map;

/**
 * The IRC implementation of a sip-communicator AccountID.
 * 
 * @author Stephane Remy
 * @author Loic Kempf
 */
public class IrcAccountID
    extends AccountID
{
    /**
     * Creates an account id from the specified id and account properties.
     *
     * @param userID the user identifier corresponding to this account
     * @param accountProperties any other properties necessary for the account.
     */
    IrcAccountID(String userID, Map accountProperties)
    {
        super(  userID,
                accountProperties,
                ProtocolNames.IRC,
                getServiceName(accountProperties));
    }
    
    /**
     * Returns the service name - the server we are logging to
     * if it is null which is not supposed to be - we return for compatibility
     * the string we used in the first release for creating AccountID
     * (Using this string is wrong, but used for compatibility for now)
     * 
     * @param accountProperties Map the properties table configuring the account
     * @return String the service name
     */
    private static String getServiceName(Map accountProperties)
    {
        String serviceName =
            (String) accountProperties
                .get(ProtocolProviderFactory.SERVER_ADDRESS);

        if(serviceName != null)
            return serviceName;
        else
            return ProtocolNames.IRC;
    }
}