QQ is the Most IM in China . So I suggest Spark Dev to add QQTransport in Spark.
1.plaease add key into spark_i18n.properties
Added key: ‘message.enter.qq’
Added key: ‘title.qq.registration’
English:
message.enter.qq= Enter your QQ Number and password below.
title.qq.registration = QQ Account Credentials
Chinese Simplified (spark_i18n_zh_CN.properties):
message.enter.qq= \u8bf7\u8f93\u5165\u60a8\u7684 QQ \u53f7\u7801\u548c\u5bc6\u7801
title.qq.registration = QQ \u8d26\u6237\u51ed\u8bc1
Chinese Traditional (spark_i18n_zh_TW.properties):
message.enter.qq= \u8acb\u8f38\u5165\u60a8\u7684 QQ \u865f\u78bc\u548c\u5bc6\u78bc
title.qq.registration = QQ \u5e33\u6236\u6191\u8b49
2.please add qq icon into images:
the icon file is:
3.Please add icon key into
\org\jivesoftware\resource\spark.properties
QQ_TRANSPORT_ACTIVE_IMAGE = images/qq_online.gif
QQ_TRANSPORT_INACTIVE_IMAGE = images/qq_offline.gif
4.QQTransport implements Transport
the code is :
package org.jivesoftware.sparkimpl.plugin.gateways.transports; import java.net.URL; import org.jivesoftware.resource.Res; import javax.swing.Icon; import javax.swing.ImageIcon; import org.jivesoftware.sparkimpl.plugin.gateways.transports.*; public class QQTransport implements Transport { // public static final String QQ_TRANSPORT_ACTIVE_IMAGE = // "QQ_TRANSPORT_ACTIVE_IMAGE"; // public static final String QQ_TRANSPORT_INACTIVE_IMAGE = // "QQ_TRANSPORT_INACTIVE_IMAGE"; org.jivesoftware.sparkimpl.plugin.gateways.GatewayPlugin gg; org.jivesoftware.spark.SparkManager gga; private String serviceName; public QQTransport(String serviceName) { this.serviceName = serviceName; System.out.println(this.getIcon()); ; System.out.println(this.getInactiveIcon()); } public String getTitle() { return "QQ ????"; // return Res.getString("title.qq.registration"); } public String getInstructions() { return "?????QQ??????"; // return Res.getString("message.enter.qq"); } public Icon getIcon() { final String iconURI = "/images/qq_online.gif"; try { final URL imageURL = //getClass().getClassLoader(). //getSystemClassLoader().getResource( getClass().getResource(iconURI); return new ImageIcon(imageURL); } catch (Exception ex) { System.out.println(iconURI + " not found."); } return null; //return SparkRes.getImageIcon(QQ_TRANSPORT_ACTIVE_IMAGE); } public Icon getInactiveIcon() { final String iconURI = "/images/qq_offline.gif"; try { final URL imageURL = //Thread.class.getClassLoader(). // getSystemClassLoader() getClass().getResource( iconURI); return new ImageIcon(imageURL); } catch (Exception ex) { System.out.println(iconURI + " not found."); } return null; //return SparkRes.getImageIcon(QQ_TRANSPORT_INACTIVE_IMAGE); } public String getServiceName() { return serviceName; } public String getName() { return "QQ"; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public Boolean requiresUsername() { return true; } public Boolean requiresPassword() { return true; } public Boolean requiresNickname() { return false; } }
5…Please add this code into GatewayPlugi’s populateTransports method
else if (entityName.endsWith(“qq.”)) {
QQTransport qqTransport = new QQTransport(item.getEntityID());
TransportUtils.addTransport(item.getEntityID(), qqTransport);
}
Then ,we can see that like:
If you like it ,I can post my QQTransport Code for OpenFire GateWay Plugin:
for more info , please see my blog:
http://618119.com/archives/2008/01/02/58.html