Bug 812921 - Land in comm-central Instantbird's changes to chat/ - 4 - Bio 1702 - Add VKontakte protocol, r=clokep,fqueze.
This commit is contained in:
Родитель
7f2836f79f
Коммит
796320bf76
|
@ -14,6 +14,7 @@ PROTOCOLS = \
|
|||
gtalk \
|
||||
irc \
|
||||
twitter \
|
||||
vkontakte \
|
||||
xmpp \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -76,3 +76,9 @@ options.connectPort=Port
|
|||
# string defined in imAccounts.properties when the user is
|
||||
# configuring a Google Talk account.
|
||||
gtalk.usernameHint=email address
|
||||
|
||||
# LOCALIZATION NOTE (vkontakte.usernameHint):
|
||||
# This is displayed inside the accountUsernameInfoWithDescription
|
||||
# string defined in imAccounts.properties when the user is
|
||||
# configuring a Vkontakte account.
|
||||
vkontakte.usernameHint=Profile ID
|
||||
|
|
|
@ -14,6 +14,7 @@ chat/protocols/gtalk/Makefile
|
|||
chat/protocols/irc/Makefile
|
||||
chat/protocols/jsTest/Makefile
|
||||
chat/protocols/twitter/Makefile
|
||||
chat/protocols/vkontakte/Makefile
|
||||
chat/protocols/xmpp/Makefile
|
||||
chat/themes/Makefile
|
||||
"
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
EXTRA_COMPONENTS = \
|
||||
vkontakte.js \
|
||||
vkontakte.manifest \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.3 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 2.1 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 627 B |
|
@ -0,0 +1,9 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
chat.jar:
|
||||
% skin prpl-vkontakte classic/1.0 %skin/classic/prpl/vkontakte/
|
||||
skin/classic/prpl/vkontakte/icon32.png (icons/prpl-vkontakte-32.png)
|
||||
skin/classic/prpl/vkontakte/icon48.png (icons/prpl-vkontakte-48.png)
|
||||
skin/classic/prpl/vkontakte/icon.png (icons/prpl-vkontakte.png)
|
|
@ -0,0 +1,56 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const {interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource:///modules/imXPCOMUtils.jsm");
|
||||
Cu.import("resource:///modules/jsProtoHelper.jsm");
|
||||
Cu.import("resource:///modules/xmpp.jsm");
|
||||
Cu.import("resource:///modules/xmpp-session.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "_", function()
|
||||
l10nHelper("chrome://chat/locale/xmpp.properties")
|
||||
);
|
||||
|
||||
function VkontakteAccount(aProtoInstance, aImAccount) {
|
||||
this._init(aProtoInstance, aImAccount);
|
||||
}
|
||||
VkontakteAccount.prototype = {
|
||||
__proto__: XMPPAccountPrototype,
|
||||
get canJoinChat() false,
|
||||
connect: function() {
|
||||
if (this.name.indexOf("@") == -1) {
|
||||
let jid = this.name + "@vk.com/" + XMPPDefaultResource;
|
||||
this._jid = this._parseJID(jid);
|
||||
}
|
||||
else {
|
||||
this._jid = this._parseJID(this.name);
|
||||
if (this._jid.domain != "vk.com") {
|
||||
// We can't use this.onError because this._connection doesn't exist.
|
||||
this.reportDisconnecting(Ci.prplIAccount.ERROR_INVALID_USERNAME,
|
||||
_("connection.error.invalidUsername"));
|
||||
this.reportDisconnected();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this._connection = new XMPPSession("vkmessenger.com", 5222,
|
||||
"require_tls", this._jid,
|
||||
this.imAccount.password, this);
|
||||
}
|
||||
};
|
||||
|
||||
function VkontakteProtocol() {
|
||||
}
|
||||
VkontakteProtocol.prototype = {
|
||||
__proto__: GenericProtocolPrototype,
|
||||
get normalizedName() "vkontakte",
|
||||
get name() "Vkontakte",
|
||||
get iconBaseURI() "chrome://prpl-vkontakte/skin/",
|
||||
get usernameEmptyText() _("vkontakte.usernameHint"),
|
||||
getAccount: function(aImAccount) new VkontakteAccount(this, aImAccount),
|
||||
classID: Components.ID("{0743ab81-8963-1743-7abc-9874823acd56}")
|
||||
};
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([VkontakteProtocol]);
|
|
@ -0,0 +1,3 @@
|
|||
component {0743ab81-8963-1743-7abc-9874823acd56} vkontakte.js
|
||||
contract @mozilla.org/chat/vkontakte;1 {0743ab81-8963-1743-7abc-9874823acd56}
|
||||
category im-protocol-plugin prpl-vkontakte @mozilla.org/chat/vkontakte;1
|
Загрузка…
Ссылка в новой задаче