Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/components/CustomWelcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ var state = kiwi.state;
var Misc = kiwi.require('helpers/Misc');
var StartupLayout = kiwi.require('components/startups/CommonLayout');

import * as utils from '../libs/utils.js';

export default {
components: {
StartupLayout,
Expand Down Expand Up @@ -139,6 +141,8 @@ export default {
},
created: function created() {
let options = state.settings.startupOptions;
let netAddress = _.trim(options.server);
let net = this.network || state.getNetworkFromAddress(netAddress);

this.nick = this.processNickRandomNumber(Misc.queryStringVal('nick') || options.nick || '');
this.password = options.password || '';
Expand All @@ -153,6 +157,14 @@ export default {
options.showPassword :
true;

if (net) {
let gecos = utils.getASL2(net.gecos);

this.age = gecos.a || '';
this.sex = gecos.s || '';
this.location = gecos.l || '';
}

if (options.autoConnect && this.nick && this.channel) {
this.startUp();
}
Expand Down
14 changes: 13 additions & 1 deletion src/libs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,16 @@ export function getASL(str) {
return {a, s, l};
}
return {};
}
}

export function getASL2(str) {
let result = str.match(/\[(\d+|U)\/([MFOU])\/(.*)\]/);
if (result && result.length === 4) {
let a = result[1] === 'U' ? null : result[1];
let s = result[2] === 'U' ? null : result[2];
let l = result[3] === 'U' ? null : result[3];

return {a, s, l};
}
return {};
}