@@ 43,11 43,20 @@ handlePresence config presence@XMPP.Presence {
XMPP.presenceFrom = Just from,
XMPP.presenceTo = Just to
}
+ | hasMucCode 110 presence, -- done joining room
+ Just source <- (XMPP.parseJID . unescapeJid . XMPP.strNode) =<< XMPP.jidNode to = do
+ when (bareTxt to == bareTxt (Config.bridgeJid config)) $ Session.cleanOld config from
+ liftIO $ DB.execute (Config.db config)
+ (s"UPDATE sessions SET target_nick=? WHERE source_muc=? AND source_nick=? AND target_muc=?")
+ (
+ XMPP.strResource <$> XMPP.jidResource from,
+ bareTxt source,
+ XMPP.strResource <$> XMPP.jidResource source,
+ bareTxt from
+ )
| bareTxt to /= bareTxt (Config.bridgeJid config) =
-- This is to one of our ghosts, so just ignore it
return ()
- | hasMucCode 110 presence = -- done joining room, clean up old data
- Session.cleanOld config from
| otherwise = forM_ (fullTargets config from) $
uncurry $ Session.sendPresenceToMUC config presence
handlePresence _ _ = return ()