/**
 * $Revision: $
 * $Date: $
 *
 * Copyright (C) 2006 Jive Software. All rights reserved.
 *
 * This software is published under the terms of the GNU Lesser Public License (LGPL),
 * a copy of which is included in this distribution.
 */

package org.jivesoftware.resource;

import javax.swing.ImageIcon;

import java.net.URL;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

public class EmotionRes {
    private static final Map emotionMap = new LinkedHashMap();
    static ClassLoader cl = EmotionRes.class.getClassLoader();

    static {
        emotionMap.put(":)", "images/emoticons/happy.gif");
        emotionMap.put(":-)", "images/emoticons/happy.gif");
        emotionMap.put(":(", "images/emoticons/sad.gif");
        emotionMap.put(":D", "images/emoticons/grin.gif");
        emotionMap.put(":x", "images/emoticons/love.gif");
        emotionMap.put(";\\", "images/emoticons/mischief.gif");
        emotionMap.put("B-)", "images/emoticons/cool.gif");
        emotionMap.put("]:)", "images/emoticons/devil.gif");
        emotionMap.put(":p", "images/emoticons/silly.gif");
        emotionMap.put("X-(", "images/emoticons/angry.gif");
        emotionMap.put(":^0", "images/emoticons/laugh.gif");
        emotionMap.put(";)", "images/emoticons/wink.gif");
        emotionMap.put(";-)", "images/emoticons/wink.gif");
        emotionMap.put(":8}", "images/emoticons/blush.gif");
        emotionMap.put(":_|", "images/emoticons/cry.gif");
        emotionMap.put("?:|", "images/emoticons/confused.gif");
        emotionMap.put(":0", "images/emoticons/shocked.gif");
        emotionMap.put(":|", "images/emoticons/plain.gif");
        emotionMap.put("8-)", "images/emoticons/eyeRoll.gif");
        emotionMap.put("|-)", "images/emoticons/sleepy.gif");
        emotionMap.put("<:o)", "images/emoticons/party.gif");
    }

    public static final ImageIcon getImageIcon(String face) {
        final String value = (String)emotionMap.get(face);
        if (value != null) {
            final URL url = cl.getResource(value);
            if (url != null) {
                return new ImageIcon(url);
            }
        }
        return null;
    }

    public static final URL getURL(String face) {
        final String value = (String)emotionMap.get(face);
        if (value != null) {
            final URL url = cl.getResource(value);
            if (url != null) {
                return url;
            }
        }
        return null;
    }

    public static Map getEmoticonMap() {
        Map newMap = new HashMap(emotionMap);
        newMap.remove("8-)");
        newMap.remove("|-)");
        newMap.remove("<:o)");
        newMap.remove(":-)");
        return newMap;
    }

}
@@ -477,16 +477,31 @@
 inal Map
+%3CString,String%3E
  emotion
@@ -523,16 +523,31 @@
 dHashMap
+%3CString,String%3E
 ();%0D%0A   
@@ -668,35 +668,35 @@
 emoticons/happy.
-gif
+png
 %22);%0D%0A        emo
@@ -738,19 +738,19 @@
 s/happy.
-gif
+png
 %22);%0D%0A   
@@ -797,19 +797,19 @@
 ons/sad.
-gif
+png
 %22);%0D%0A   
@@ -857,19 +857,19 @@
 ns/grin.
-gif
+png
 %22);%0D%0A   
@@ -917,19 +917,19 @@
 ns/love.
-gif
+png
 %22);%0D%0A   
@@ -982,19 +982,19 @@
 ischief.
-gif
+png
 %22);%0D%0A   
@@ -1043,19 +1043,19 @@
 ns/cool.
-gif
+png
 %22);%0D%0A   
@@ -1105,19 +1105,19 @@
 s/devil.
-gif
+png
 %22);%0D%0A   
@@ -1166,19 +1166,19 @@
 s/silly.
-gif
+png
 %22);%0D%0A   
@@ -1228,19 +1228,19 @@
 s/angry.
-gif
+png
 %22);%0D%0A   
@@ -1290,19 +1290,19 @@
 s/laugh.
-gif
+png
 %22);%0D%0A   
@@ -1342,35 +1342,35 @@
 /emoticons/wink.
-gif
+png
 %22);%0D%0A        emo
@@ -1411,19 +1411,19 @@
 ns/wink.
-gif
+png
 %22);%0D%0A   
@@ -1473,19 +1473,19 @@
 s/blush.
-gif
+png
 %22);%0D%0A   
@@ -1533,19 +1533,19 @@
 ons/cry.
-gif
+png
 %22);%0D%0A   
@@ -1598,19 +1598,19 @@
 onfused.
-gif
+png
 %22);%0D%0A   
@@ -1661,19 +1661,19 @@
 shocked.
-gif
+png
 %22);%0D%0A   
@@ -1722,19 +1722,19 @@
 s/plain.
-gif
+png
 %22);%0D%0A   
@@ -1947,22 +1947,16 @@
  static 
-final 
 ImageIco
@@ -2011,32 +2011,24 @@
 ing value = 
-(String)
 emotionMap.g
@@ -2271,22 +2271,16 @@
  static 
-final 
 URL getU
@@ -2331,16 +2331,8 @@
 e = 
-(String)
 emot
@@ -2603,16 +2603,31 @@
      Map
+%3CString,String%3E
  newMap 
@@ -2639,16 +2639,31 @@
  HashMap
+%3CString,String%3E
 (emotion

Fixing emoticons.