'From etoys3.0 of 7 March 2008 [latest update: #2152] on 19 September 2008 at 7:54:23 pm'! "Change Set: buddyFixes-bf Date: 19 September 2008 Author: Bert Freudenberg Compose buddy nick name. Protect against empty color string."! !SugarBuddy class methodsFor: 'instance creation' stamp: 'bf 9/19/2008 18:36'! fromDictionary: aDict | buddyClass | buddyClass := SugarBuddy. (aDict at: 'owner' ifAbsent: []) == true ifTrue: [ buddyClass := SugarBuddyOwner. Utilities authorName: (aDict at: 'nick' ifAbsent: ['missing nick']) utf8ToSqueak composeAccents]. ^buddyClass key: (aDict at: 'key' ifAbsent: ['missing key']) nick: (aDict at: 'nick' ifAbsent: ['missing nick']) utf8ToSqueak composeAccents colors: (aDict at: 'color' ifAbsent: ['missing color']) ip: (aDict at: 'ip4-address' ifAbsent: ['missing address']) ! ! !SugarBuddy class methodsFor: 'instance creation' stamp: 'bf 9/19/2008 18:31'! key: keyString nick: nickString colors: colorString ip: ipString "SugarBuddy key: '1234' nick: 'nick' colors: '#ff0000,#ffff00' ip: '1.2.3.4'" | colors | colors := (colorString findTokens: '#,') collect: [:c | Color fromString: c]. colors size = 2 ifFalse: [colors := {Color black. Color white}]. ^self key: keyString nick: nickString border: colors first fill: colors second ip: ipString ! !