Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { JID } from '@xmpp/jid';
/*
* All return an instance of JID.JID, the new operator is optional.
*/
let addr = new JID('alice@wonderland.net/rabbithole'); // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole'); // BEST; see section on escaping below
/*
* local
*/
addr.local = 'alice';
addr.local; // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice
/*
* domain
*/
addr.domain = 'wonderland.net';
addr.domain; // wonderland.net
// same as
import {JID} from '@xmpp/jid';
/*
* All return an instance of JID.JID, the new operator is optional.
*/
let addr = new JID('alice@wonderland.net/rabbithole'); // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole'); // BEST; see section on escaping below
/*
* local
*/
addr.local = 'alice';
addr.local; // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice
/*
* domain
*/
addr.domain = 'wonderland.net';
addr.domain; // wonderland.net
// same as
addr.setDomain('wonderland.net');
addr.getDomain(); // wonderland.net
/*
* resource
*/
addr.resource = 'rabbithole';
addr.resource; // rabbithole
// same as
addr.setResource('rabbithole');
addr.getResource(); // rabbithole
addr.toString(); // alice@wonderland.net/rabbithole
addr.bare(); // returns a JID without resource
const some_jid = new JID('is', 'a', 'test');
addr.equals(some_jid); // returns true if the two JIDs are equal, false otherwise
import { JID } from '@xmpp/jid';
/*
* All return an instance of JID.JID, the new operator is optional.
*/
let addr = new JID('alice@wonderland.net/rabbithole'); // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole'); // BEST; see section on escaping below
/*
* local
*/
addr.local = 'alice';
addr.local; // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice
/*
* domain
*/
addr.domain = 'wonderland.net';
addr.domain; // wonderland.net
addr.setDomain('wonderland.net');
addr.getDomain(); // wonderland.net
/*
* resource
*/
addr.resource = 'rabbithole';
addr.resource; // rabbithole
// same as
addr.setResource('rabbithole');
addr.getResource(); // rabbithole
addr.toString(); // alice@wonderland.net/rabbithole
addr.bare(); // returns a JID without resource
const some_jid = new JID('is', 'a', 'test');
addr.equals(some_jid); // returns true if the two JIDs are equal, false otherwise
import {JID} from '@xmpp/jid';
/*
* All return an instance of JID.JID, the new operator is optional.
*/
let addr = new JID('alice@wonderland.net/rabbithole'); // OK
addr = new JID('alice', 'wonderland.net', 'rabbithole'); // BEST; see section on escaping below
/*
* local
*/
addr.local = 'alice';
addr.local; // alice
// same as
addr.setLocal('alice');
addr.getLocal(); // alice
/*
* domain
*/
addr.domain = 'wonderland.net';
addr.domain; // wonderland.net
providers: [
XmppChatConnectionService,
XmppChatAdapter,
{provide: LogService, useValue: testLogService()},
ContactFactoryService
]
});
chatConnectionService = TestBed.get(XmppChatConnectionService);
chatConnectionService.client = xmppClientMock;
contactFactory = TestBed.get(ContactFactoryService);
chatAdapter = TestBed.get(XmppChatAdapter);
logService = TestBed.get(LogService);
chatAdapter.addPlugins([new RosterPlugin(chatAdapter, logService)]);
chatConnectionService.userJid = new JID('me', 'example.com', 'something');
});
{provide: LogService, useValue: logService},
ContactFactoryService
]
});
chatService = TestBed.get(ChatServiceToken);
chatConnectionService = TestBed.get(XmppChatConnectionService);
chatConnectionService.client = xmppClientMock;
contactFactory = TestBed.get(ContactFactoryService);
chatService.addPlugins([new MessageUuidPlugin(), new MessagePlugin(chatService, logService)]);
contact1 = contactFactory.createContact('test@example.com', 'jon doe');
contact2 = contactFactory.createContact('test2@example.com', 'jane dane');
contacts = [contact1, contact2];
chatConnectionService.userJid = new JID('me', 'example.com', 'something');
});