@@ -123,25 +123,27 @@ func (app *App) saveItemProcessor(msg *cot.CotMessage) bool {
123123 app .items .Store (c )
124124
125125 if cl == model .CONTACT && ! online {
126- app .newContact (c , lastSeen )
126+ app .processNewContact (c , lastSeen )
127127 }
128128 } else {
129129 app .logger .Info (fmt .Sprintf ("new %s %s (%s) %s" , cl , msg .GetUID (), msg .GetCallsign (), msg .GetType ()))
130130 item := model .FromMsg (msg )
131131 app .items .Store (item )
132132
133133 if cl == model .CONTACT {
134- app .newContact (item , time .Now ().Add (- 1 * model .StaleContactDelete ))
134+ app .processNewContact (item , time .Now ().Add (- 1 * model .StaleContactDelete ))
135135 }
136136 }
137137
138138 return true
139139}
140140
141- func (app * App ) newContact (item * model.Item , lastSeen time.Time ) {
142- if time .Since (lastSeen ) > time .Hour * 24 && app .config .WelcomeMsg () != "" {
143- chat := chat .MakeChatMessage (item .GetUID (), WELCOME_MESSAGE_FROM_UID , item .GetCallsign (), "" , "RootContactGroup" , app .config .WelcomeMsg ())
144- app .sendToUID (item .GetUID (), cot .LocalCotMessage (chat ))
141+ func (app * App ) processNewContact (item * model.Item , lastSeen time.Time ) {
142+ if time .Since (lastSeen ) > time .Hour * 24 {
143+ if msg := app .config .WelcomeForScope (item .GetScope ()); msg != "" {
144+ chat := chat .MakeChatMessage (item .GetUID (), WELCOME_MESSAGE_FROM_UID , item .GetCallsign (), "" , "RootContactGroup" , msg )
145+ app .sendToUID (item .GetUID (), cot .LocalCotMessage (chat ))
146+ }
145147 }
146148
147149 msgs := app .messages .GetFor (item , lastSeen )
0 commit comments