[Pound-commit] pound: 2 new changesets
Status: Beta
Brought to you by:
rubin
From: Mercurial C. M. <pou...@li...> - 2010-01-16 16:05:17
|
details: http://pound.hg.sourceforge.net:8000/hgroot/pound/pound/rev/7b5282242198 changeset: 30:7b5282242198 user: rubin@snark date: Sat Nov 28 10:22:56 2009 -0600 description: less delay when connecting, fix ctcps, more verbosity about poll results printed to status window details: http://pound.hg.sourceforge.net:8000/hgroot/pound/pound/rev/fcdc04776817 changeset: 31:fcdc04776817 user: rubin@snark date: Sat Jan 16 10:05:05 2010 -0600 description: add IRC to name, put nickname on first screen, and roll version to 1.2 diffstat: app/assistants/channel-assistant.js | 2 +- app/assistants/first-assistant.js | 38 ++++++++++++++++++++++++++++++- app/assistants/netoptions-assistant.js | 18 +-------------- app/views/first/first-scene.html | 13 ++++++++-- appinfo.json | 4 +- libs/irc.js | 41 +++++++++++++++++++++++++++++---- stylesheets/ir.css | 24 +++++++++++++++++++ 7 files changed, 111 insertions(+), 29 deletions(-) diffs (286 lines): diff -r 845e27ca2746 -r fcdc04776817 app/assistants/channel-assistant.js --- a/app/assistants/channel-assistant.js Sat Nov 28 02:16:45 2009 -0600 +++ b/app/assistants/channel-assistant.js Sat Jan 16 10:05:05 2010 -0600 @@ -144,7 +144,7 @@ this.controller.showAlertDialog({ onChoose: doClose, title: "Disconnected", - message: "You were disconnected from __netname__.", + message: "You were disconnected from "+tab.network+".", choices:[ {label:"Reconnect", value:1, type:'affirmative'}, {label:"Close", value:2, type:'negative'}, diff -r 845e27ca2746 -r fcdc04776817 app/assistants/first-assistant.js --- a/app/assistants/first-assistant.js Sat Nov 28 02:16:45 2009 -0600 +++ b/app/assistants/first-assistant.js Sat Jan 16 10:05:05 2010 -0600 @@ -110,7 +110,7 @@ // Edit button this.editButtonAttributes = {}; this.editButtonModel = { - "buttonLabel" : "edit", + "buttonLabel" : "Network Preferences", "buttonClass" : "", "disabled" : true }; @@ -141,6 +141,21 @@ Mojo.Log.error(err); } Mojo.Event.listen(this.controller.get("netListSelector"), Mojo.Event.propertyChange, this.handleNetListSelectorUpdate.bindAsEventListener(this)); + + + try { + + this.fieldNicknameAttributes = { +hintText: '', multiline: false, enterSubmits: false, focus: false, textCase: Mojo.Widget.steModeLowerCase, autoReplace: false, focusMode: Mojo.Widget.focusSelectMode, charsAllow: irc.isValidNicknameChar.bind(this)}; + this.fieldNicknameModel = {value: 'Undefined', disabled: false}; + this.controller.setupWidget("fieldNickname", this.fieldNicknameAttributes, this.fieldNicknameModel); + this.fieldNickname = this.controller.get("fieldNickname"); + Mojo.Event.listen(this.fieldNickname, Mojo.Event.propertyChange, this.handleNicknameUpdate.bind(this)); + + } catch(nickErr) { + Mojo.Log.error(nickErr); + } + // Done }; @@ -181,6 +196,13 @@ // Mojo.Log.info("Changing up model"); this.controller.modelChanged(this.netListSelectorModel, this); this.selectedNetwork = this.prefs.networks[selection]; + + this.fieldNicknameModel.value = this.selectedNetwork.nick1; + this.controller.modelChanged(this.fieldNicknameModel, this); + //this.fieldNickname.blur(); + //this.fieldNickname.focus(); + //this.fieldNickname.setCursorPosition(0,99999); + } catch(loadErr) { Mojo.Log.error("loadForm(): "+loadErr); } }; @@ -209,6 +231,20 @@ FirstAssistant.prototype.handleNetListSelectorUpdate = function(event){ // Mojo.Log.info("handleNetListSelectorUpdate(): setting selected network value"); this.selectedNetwork = this.prefs.networks[event.value]; + + this.fieldNicknameModel.value = this.selectedNetwork.nick1; + this.controller.modelChanged(this.fieldNicknameModel, this); + //this.fieldNickname.blur(); + //this.fieldNickname.focus(); + //this.fieldNickname.setCursorPosition(0,99999); +}; + +// Nickname change +FirstAssistant.prototype.handleNicknameUpdate = function(event) { + Mojo.Log.info("Setting active nick on "+ this.selectedNetwork.name + "to " + event.value); + this.selectedNetwork.nick1 = event.value; + this.useNickname = event.value; + //TODO: save this nick to selected network prefs }; FirstAssistant.prototype.activate = function(event) { diff -r 845e27ca2746 -r fcdc04776817 app/assistants/netoptions-assistant.js --- a/app/assistants/netoptions-assistant.js Sat Nov 28 02:16:45 2009 -0600 +++ b/app/assistants/netoptions-assistant.js Sat Jan 16 10:05:05 2010 -0600 @@ -137,7 +137,7 @@ this.fieldNicknameAttributes = { -hintText: '', multiline: false, enterSubmits: false, focus: false, textCase: Mojo.Widget.steModeLowerCase, autoReplace: false, charsAllow: this.isValidNicknameChar.bind(this)}; +hintText: '', multiline: false, enterSubmits: false, focus: false, textCase: Mojo.Widget.steModeLowerCase, autoReplace: false, charsAllow: irc.isValidNicknameChar.bind(this)}; this.fieldNicknameModel = {value: '', disabled: true}; this.controller.setupWidget("fieldNickname", this.fieldNicknameAttributes, this.fieldNicknameModel); this.fieldNickname = this.controller.get("fieldNickname"); @@ -221,22 +221,6 @@ /* add event handlers to listen to events from widgets */ }; -NetoptionsAssistant.prototype.isValidNicknameChar = function(c) { - Mojo.Log.info("isValidNicknameChar("+c+")"); - // TODO: rewrite this properly, its shamefull - if( (c >= 97 && c <= 122) || /* a-z */ - (c >= 65 && c <= 90) || /* A-Z */ - (c >= 48 && c <= 57) || /* 0-9 */ - (c >= 91 && c <= 93) || /* [, /, ] */ - c === 123 || /* { */ - c === 125 || /* } */ - c === 45 || /* - */ - (c === 94 || c === 95 || c === 96) /* ^, _, ` */ ) { - return true; - } - return false; -}; - NetoptionsAssistant.prototype.ready = function() { this.updateForm(); }; diff -r 845e27ca2746 -r fcdc04776817 app/views/first/first-scene.html --- a/app/views/first/first-scene.html Sat Nov 28 02:16:45 2009 -0600 +++ b/app/views/first/first-scene.html Sat Jan 16 10:05:05 2010 -0600 @@ -1,11 +1,18 @@ <div id="main" class="palm-hasheader"> - <div class="palm-header">Pound</div> + <div class="palm-header">Pound IRC</div> <div id="myAbout"> - <h1># Pound</h1> + <h1># Pound IRC</h1> <p>QWebIRC front-end for WebOS. You can IRC on your Pre!</p> </div> <div id="netListSelector" name="netListSelector" x-mojo-element="ListSelector" class="listselectorClass"></div> + + <div id="fieldTitleNickname" class="xxfieldtitle">NICKNAME</div> + + <div id="fieldNickname" name="fieldNickname" x-mojo-element="TextField"></div> + + <div id="editButton" name="editButton" x-mojo-element="Button"></div> + <div id="connectButton" name="connectButton" x-mojo-element="Button"></div> - <div id="editButton" name="editButton" x-mojo-element="Button"></div> + </div> diff -r 845e27ca2746 -r fcdc04776817 appinfo.json --- a/appinfo.json Sat Nov 28 02:16:45 2009 -0600 +++ b/appinfo.json Sat Jan 16 10:05:05 2010 -0600 @@ -1,9 +1,9 @@ { "id": "org.simplanet.pound", - "version": "0.1.1", + "version": "0.1.2", "vendor": "Simplanet", "type": "web", "main": "index.html", - "title": "Pound", + "title": "Pound IRC", "icon": "icon.png" } diff -r 845e27ca2746 -r fcdc04776817 libs/irc.js --- a/libs/irc.js Sat Nov 28 02:16:45 2009 -0600 +++ b/libs/irc.js Sat Jan 16 10:05:05 2010 -0600 @@ -350,7 +350,7 @@ } }, cOnPRIVMSG: function(command, from, args) { - if(args[0].startsWith("\x01")) { + if(args[1].startsWith("\x01")) { this.cOnCTCPREQUEST(command, from, args); } else { @@ -619,6 +619,9 @@ this.quit(args.join(" ")); this.print("* Sent quit: "+args.join(" ")); }, + doQ: function(args) { + this.doQUIT(args); + }, command: function(text) { // input via server tab, or passed from a channel object which couldnt handle it. // first off, if it starts with a /, check it for command list items. @@ -998,6 +1001,7 @@ } else { Mojo.Log.info("poll reply is empty!"); + this.print("*** Empty response from poll. Is qWebIRC url correct?"); //this.print("* Poll reply is empty, giving up. Is the network qWebIRC url correct?"); //TODO: get here when https with bad cert. alert or something? //Hmm. apparently this also comes up in other situations.. @@ -1010,20 +1014,29 @@ if(json[0] === false) { //TODO: ack? Mojo.Log.error("Got a false back from qwebirc: "+json[1]); - this.connected = false; + this.print("*** Not connected"); + // If we think we are connected, show the disconnect dialog, cos we aren't + if(this.connected === true) { + this.irc.tabEvent("DISCONNECTED", this); + this.connected = false; + } } else { //TODO: Then, setup a timer to query again in 2 seconds.. - this.pollTimer = setTimeout(this._poll.bind(this), 2000); // First, if this is our first response from the server, // take the cookie and immediately send it back if(this.connected === false && json[1]) { this.connected = true; this.sCookie = json[1]; - //Mojo.Log.info("First connect, sending back session cookie: '"+this.sCookie+"'"); + clearTimeout(this.pollTimer); + this.pollTimer = setTimeout(this._poll.bind(this), 1000); + Mojo.Log.info("First connect, sending back session cookie: '"+this.sCookie+"'"); + this.print("*** Setting up connection"); this._ajaxSend({r: "blahblahblah2", t:this.timeCounter++, s:this.sCookie}, 's'); } else { // Normal data back from server, parse it - //Mojo.Log.info("Calling parseLine on data"); + Mojo.Log.info("Calling parseLine on data"); + clearTimeout(this.pollTimer); + this.pollTimer = setTimeout(this._poll.bind(this), 2000); json.forEach(this.parseLine.bind(this)); //this.parseLine(json[0]); } @@ -1033,11 +1046,13 @@ // set connected to false, clear cookie. maybe reconnect if set to? Save // the error for a dialog? I dunno :) Mojo.Log.info("Got error callback."); + this.print("*** Poll resulted in error"); //TODO this.disconnect(1); // 1 for if there was an error, 0 for not (so send quit msg) try { if(this.connected === true) { this.irc.tabEvent("DISCONNECTED", this); + this.print("*** Disconnected"); } } @@ -1175,3 +1190,19 @@ } }); +irc.isValidNicknameChar = function(c) { + Mojo.Log.info("isValidNicknameChar("+c+")"); + // TODO: rewrite this properly, its shamefull + if( (c >= 97 && c <= 122) || /* a-z */ + (c >= 65 && c <= 90) || /* A-Z */ + (c >= 48 && c <= 57) || /* 0-9 */ + (c >= 91 && c <= 93) || /* [, /, ] */ + c === 123 || /* { */ + c === 125 || /* } */ + c === 45 || /* - */ + (c === 94 || c === 95 || c === 96) /* ^, _, ` */ ) { + return true; + } + return false; +}; + diff -r 845e27ca2746 -r fcdc04776817 stylesheets/ir.css --- a/stylesheets/ir.css Sat Nov 28 02:16:45 2009 -0600 +++ b/stylesheets/ir.css Sat Jan 16 10:05:05 2010 -0600 @@ -173,4 +173,28 @@ -webkit-palm-mouse-target: ignore; } +#myAbout { + padding: 0px; + margin: 0px; +} +#myAbout h1 { + padding: 0px; + margin: 0px; +} + +#myAbout p { + padding: 0px; + margin: 0px; + margin-bottom: 1em; +} + +#fieldTitleNickname { + font-size: 0.7em; + color: #56F; + width: 30%; + padding-top: 15px; +} + +#fieldNickname { +} |