Monday, November 08, 2010 at 12:00 AM.
scripting2Suite.editor.io.boldenBuddy
on boldenBuddy (name) {
<<Changes
<<7/15/10; 11:09:21 AM by DW
<<Cribbed from instantOutline.root.
<<7/21/08; 8:58:41 AM by DW
<<Beep on each update, subject to pref.
<<Also fixed bug, atts.bold wasn't being set for an already-existing user. Wasn't calling op.attributes.addgroup.
<<7/19/08; 2:10:42 PM by DW
<<Insert new buddies at the bottom, not the top.
<<7/19/08; 2:01:51 PM by DW
<<Handle empty buddy outline (startup).
<<7/19/08; 9:22:55 AM by DW
<<Created. Add the user to the buddy outline if not already there, bolden if there.
local (adrdata = scripting2suite.init ());
on beep () {
if adrdata^.editor.prefs.flBeepOnBuddyUpdate {
speaker.sound (1, 100, 5000)}};
local (oldtarget = target.set (@adrdata^.editor.buddies.outline));
local (oldcursor = op.getcursor (), flfound = false, atts);
op.firstsummit ();
loop {
op.attributes.getall (@atts);
if defined (atts.name) {
if atts.name == name {
flfound = true;
if not atts.bold {
op.setlinetext ("<b>" + op.getlinetext () + "</b>");
atts.bold == true;
op.attributes.addgroup (@atts); //7/21/08 by DW
beep ()};
break}};
if not op.go (down, 1) {
break}};
if not flfound {
<<op.firstsummit ()
bundle { //insert the new line
local (s = "<b>" + name + "</b>");
if op.getrefcon () == 0 { //no atts
op.setlinetext (s)}
else {
op.insert (s, down)}};
new (tabletype, @atts);
atts.name = name;
atts.type = "v3BuddyOutlineElement";
atts.bold = true;
op.attributes.addgroup (@atts);
beep ()};
op.setcursor (oldcursor);
target.set (oldtarget)};
bundle { //test code
boldenBuddy ("davewiner")}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.