summaryrefslogtreecommitdiff
path: root/Presence/main.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2013-07-08 22:47:29 -0400
committerjoe <joe@jerkface.net>2013-07-08 22:47:29 -0400
commitc0895f5a2e604bc4594354399498e2ebb19d8c8e (patch)
treeb5e636cf451f32f67e9fbc6fdd9c003e5afde8c4 /Presence/main.hs
parent88274ed5e6d6ffa37683c7e213095d23fd31decd (diff)
maintain uniqueness of items in config lists
Diffstat (limited to 'Presence/main.hs')
-rw-r--r--Presence/main.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Presence/main.hs b/Presence/main.hs
index a7ff5e5a..bbaac97a 100644
--- a/Presence/main.hs
+++ b/Presence/main.hs
@@ -105,6 +105,15 @@ data ClientSession = ClientSession {
105 presence_state :: PresenceState 105 presence_state :: PresenceState
106} 106}
107 107
108addJid modify user jid = do
109 newitem <- parseHostNameJID jid
110 let cmp jid = do
111 -- putStrLn $ "Comparing "<++>bshow jid
112 olditem <- parseHostNameJID jid
113 if olditem==newitem then return Nothing
114 else return $ Just jid
115 modify user cmp (Just jid)
116
108instance JabberClientSession ClientSession where 117instance JabberClientSession ClientSession where
109 data XMPPClass ClientSession = ClientSessions PresenceState 118 data XMPPClass ClientSession = ClientSessions PresenceState
110 119
@@ -189,7 +198,7 @@ instance JabberClientSession ClientSession where
189 198
190 addSolicited s jid = do 199 addSolicited s jid = do
191 user <- readIORef (unix_uid s) >>= getJabberUserForId 200 user <- readIORef (unix_uid s) >>= getJabberUserForId
192 ConfigFiles.addSolicited user jid -- (L.show jid) 201 addJid ConfigFiles.modifySolicited user jid
193 let rchan = rosterChannel . presence_state $ s 202 let rchan = rosterChannel . presence_state $ s
194 atomically $ do 203 atomically $ do
195 isempty <- isEmptyTMVar rchan 204 isempty <- isEmptyTMVar rchan