summaryrefslogtreecommitdiff
path: root/Presence/main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Presence/main.hs')
-rw-r--r--Presence/main.hs25
1 files changed, 19 insertions, 6 deletions
diff --git a/Presence/main.hs b/Presence/main.hs
index 25ac994b..0eae8677 100644
--- a/Presence/main.hs
+++ b/Presence/main.hs
@@ -86,7 +86,7 @@ data PresenceState = PresenceState
86 86
87getJabberUserForId muid = 87getJabberUserForId muid =
88 maybe (return "nobody") 88 maybe (return "nobody")
89 (\uid -> 89 (\(uid,_) ->
90 handle (\(SomeException _) -> 90 handle (\(SomeException _) ->
91 return . L.append "uid." . L.pack . show $ uid) 91 return . L.append "uid." . L.pack . show $ uid)
92 $ do 92 $ do
@@ -129,8 +129,7 @@ instance JabberClientSession ClientSession where
129 129
130 getJID s = do 130 getJID s = do
131 let host = localhost s 131 let host = localhost s
132 muid <- fmap (fmap fst) $ readIORef (unix_uid s) 132 user <- readIORef (unix_uid s) >>= getJabberUserForId
133 user <- getJabberUserForId muid
134 133
135 rsc <- readIORef (unix_resource s) 134 rsc <- readIORef (unix_resource s)
136 -- let jid = user <++> "@" <++> host <++?> "/" <++$> rsc 135 -- let jid = user <++> "@" <++> host <++?> "/" <++$> rsc
@@ -169,6 +168,23 @@ instance JabberClientSession ClientSession where
169 L.putStrLn $ "cached presence: " <++> bshow p 168 L.putStrLn $ "cached presence: " <++> bshow p
170 action p 169 action p
171 170
171 getMyBuddies s = do
172 user <- readIORef (unix_uid s) >>= getJabberUserForId
173 ConfigFiles.getBuddies user
174 getMySubscribers s = do
175 user <- readIORef (unix_uid s) >>= getJabberUserForId
176 ConfigFiles.getSubscribers user
177 getMyOthers s = do
178 user <- readIORef (unix_uid s) >>= getJabberUserForId
179 ConfigFiles.getOthers user
180 getMyPending s = do
181 user <- readIORef (unix_uid s) >>= getJabberUserForId
182 ConfigFiles.getPending user
183 getMySolicited s = do
184 user <- readIORef (unix_uid s) >>= getJabberUserForId
185 ConfigFiles.getSolicited user
186
187
172tupleToJID (user,tty,pid) = jid user LocalHost tty 188tupleToJID (user,tty,pid) = jid user LocalHost tty
173 189
174data PeerSession = PeerSession { 190data PeerSession = PeerSession {
@@ -229,9 +245,6 @@ instance JabberPeerSession PeerSession where
229 245
230 getBuddies _ user = ConfigFiles.getBuddies user 246 getBuddies _ user = ConfigFiles.getBuddies user
231 getSubscribers _ user = ConfigFiles.getSubscribers user 247 getSubscribers _ user = ConfigFiles.getSubscribers user
232 getOthers _ user = ConfigFiles.getOthers user
233 getPending _ user = ConfigFiles.getPending user
234 getSolicited _ user = ConfigFiles.getSolicited user
235 248
236 249
237subscribeToChan tmvar = 250subscribeToChan tmvar =