diff options
author | joe <joe@jerkface.net> | 2013-07-08 22:47:29 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2013-07-08 22:47:29 -0400 |
commit | c0895f5a2e604bc4594354399498e2ebb19d8c8e (patch) | |
tree | b5e636cf451f32f67e9fbc6fdd9c003e5afde8c4 /Presence/main.hs | |
parent | 88274ed5e6d6ffa37683c7e213095d23fd31decd (diff) |
maintain uniqueness of items in config lists
Diffstat (limited to 'Presence/main.hs')
-rw-r--r-- | Presence/main.hs | 11 |
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 | ||
108 | addJid 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 | |||
108 | instance JabberClientSession ClientSession where | 117 | instance 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 |