Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

copy pasting line breaks, filter buddies by custom status

  • Loading branch information...
commit da24c2be037965a5b2721eddbf95301da5fb91dd 1 parent f5bf348
@andysprout andysprout authored
View
27 src/RegexTest.mxml
@@ -2,7 +2,7 @@
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
- creationComplete="run()" height="600" width="600">
+ creationComplete="run()" height="600" width="600" xmlns:messages="com.cleartext.esm.views.messages.*">
<s:layout>
<s:VerticalLayout>
@@ -12,7 +12,9 @@
<fx:Script>
<![CDATA[
import com.cleartext.esm.models.utils.LinkUitls;
+ import com.cleartext.esm.models.valueObjects.Message;
+ import mx.core.UITextField;
import mx.utils.StringUtil;
private var tweets:Array = [
@@ -48,6 +50,7 @@
text:"<a href='http://search.twitter.com/search?q=%23ximpp'> # <b>ximpp</b> </a> t <a href='http://search.twitter.com/search?q=%23ximppbb'>#ximppbb</a> t bb#ximppbb t bb#ximppbb t <b>ximpp</b> t ximppbb t bbximpp t bbximppbb t <b>ximpp</b> <b>ximpp</b> <a href=\"http://search.twitter.com/search?q=%23ximpp\" onclick=\"pageTracker._setCustomVar(2, 'result_type', 'recent', 3);pageTracker._trackPageview('/intra/hashtag/#ximpp');\"> # <b>ximpp</b> </a> <a href=\"http://search.twitter.com/search?q=%23ximppbb\" onclick=\"pageTracker._setCustomVar(2, 'result_type', 'recent', 3);pageTracker._trackPageview('/intra/hashtag/#ximppbb');\">#ximppbb</a> bbximpp <b>ximpp</b>"}
];
+ private var bodyTextField:UITextField;
private var tweetRegExpString:String =
"<img src=('|\")" + // open img tag with src=" or src='
@@ -124,12 +127,32 @@
var result:String = LinkUitls.createLinks(input.text, [], linkVals[0], linkVals[1], linkVals[2], linkVals[3]);
plainConsole.text = result;
htmlConsole.htmlText = result;
+
+ bodyTextField.htmlText = result;
+ }
+
+ override protected function createChildren():void
+ {
+ super.createChildren();
+
+ bodyTextField = new UITextField();
+ bodyTextField.autoSize = TextFieldAutoSize.NONE;
+ bodyTextField.ignorePadding = true;
+ bodyTextField.multiline = true;
+ bodyTextField.selectable = true;
+ bodyTextField.type = TextFieldType.DYNAMIC;
+ bodyTextField.wordWrap = true;
+ bodyTextField.width = 600;
+ bodyTextField.height = 150;
+ uic.addChild(bodyTextField);
}
+
]]>
</fx:Script>
- <s:TextInput id="input" width="600" height="150" change="handler()" text="Whiteboarding bbc.co.uk abc.com.au/hello @google/xmpp using #pidgin ...... http://www.rohanjain.in/blog/whiteboarding-with-xmpp-google-talk/#updates b lad www.hello.com #hll blah"/>
+ <s:TextArea id="input" width="600" height="150" change="handler()" text="Whiteboarding bbc.co.uk abc.com.au/hello @google/xmpp using #pidgin ...... http://www.rohanjain.in/blog/whiteboarding-with-xmpp-google-talk/#updates b lad www.hello.com #hll blah"/>
<mx:Text id="plainConsole" width="600" height="150"/>
<mx:Text id="htmlConsole" width="600" height="150"/>
+ <mx:UIComponent id="uic" width="600" height="150" />
</s:WindowedApplication>
View
2  src/com/cleartext/esm/models/ApplicationModel.as
@@ -588,7 +588,7 @@ package com.cleartext.esm.models
if(linkVals)
newMessage.displayMessage = LinkUitls.createLinks(newMessage.plainMessage, newMessage.searchTerms, linkVals[0], linkVals[1], linkVals[2], linkVals[3]);
else if(stanza.html)
- newMessage.displayMessage = stanza.html;
+ newMessage.displayMessage = LinkUitls.replaceLineBreaks(stanza.html);
else
newMessage.displayMessage = LinkUitls.createLinks(newMessage.plainMessage, newMessage.searchTerms);
View
11 src/com/cleartext/esm/models/ContactModel.as
@@ -181,10 +181,13 @@ package com.cleartext.esm.models
!(contact is BuddyGroup))
return false;
- if(searchString != "" &&
- (contact.nickname.toLowerCase().search(searchString.toLowerCase()) == -1 &&
- contact.jid.toLowerCase().search(searchString.toLowerCase()) == -1))
- return false;
+ var lower:String = searchString.toLowerCase();
+ if(lower != "" &&
+ contact.nickname.toLowerCase().search(lower) == -1 &&
+ contact.jid.toLowerCase().search(lower) == -1 &&
+ (contact.customStatus == null ||
+ contact.customStatus.toLowerCase().search(lower) == -1))
+ return false;
if(groupName == OPEN_TABS)
return contact.openTab;
View
2  src/com/cleartext/esm/models/XMPPModel.as
@@ -263,7 +263,7 @@ package com.cleartext.esm.models
gotRosterList = false;
sendIq(settings.userAccount.jid,
IQTypes.GET,
- <query xmlns={JABBER_ROSTER_NS}/>,
+ <query xmlns={JABBER_ROSTER_NS} ver='329eg'/>,
getRosterHandler);
// get the vCard stored on the server
View
7 src/com/cleartext/esm/models/utils/LinkUitls.as
@@ -88,6 +88,8 @@ package com.cleartext.esm.models.utils
// remove any existing tags
linkText = LinkUitls.removeALlTags(linkText);
+
+ linkText = LinkUitls.replaceLineBreaks(linkText);
// trim whitspace off the ends
linkText = StringUtil.trim(linkText);
@@ -163,6 +165,11 @@ package com.cleartext.esm.models.utils
return str;
}
+ public static function replaceLineBreaks(str:String):String
+ {
+ return str.replace(new RegExp("\n|\r", "ig"), "<BR />");
+ }
+
public static function createSpecialLinks(str:String, urlStart:String, urlEnd:String, specialChar:String):String
{
var inLinkTag:int = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.