package Ġcom . d zen . camp fire . server . tables Ċ Ċ import Ġcom . d zen . camp fire . api . API Ċ import Ġcom . sup . dev . java _ pc . sql . Sql Ċ Ċ object ĠT Ch ats Ġ{ ĊĊĠĠĠ Ġval ĠNAME Ġ= Ġ" ch ats " ĊĠĠĠ Ġval Ġid Ġ= Ġ" id " ĊĠĠĠ Ġval Ġtype Ġ= Ġ" type " ĊĠĠĠ Ġval Ġf andom _ id Ġ= Ġ" f andom _ id " ĊĠĠĠ Ġval Ġlanguage _ id Ġ= Ġ" language _ id " ĊĠĠĠ Ġval Ġdate _ create Ġ= Ġ" date _ create " ĊĠĠĠ Ġval Ġname Ġ= Ġ" name " ĊĠĠĠ Ġval Ġimage _ id Ġ= Ġ" image _ id " ĊĠĠĠ Ġval Ġbackground _ id Ġ= Ġ" background _ id " ĊĠĠĠ Ġval Ġcreator _ id Ġ= Ġ" creator _ id " ĊĠĠĠ Ġval Ġchat _ params Ġ= Ġ" chat _ params " ĊĊĠĠĠ Ġval ĠMEMBER S _ COUNT Ġ= Ġ"( SELECT Ġ${ Sql . COUNT } ĠFROM Ġ${ T Ch ats Subscriptions . NAME } Ġas Ġt Ġ ĠWHERE Ġt .${ T Ch ats Subscriptions . chat _ type } =$ type ĠAND Ġt .${ T Ch ats Subscriptions . target _ id } =$ id )" ĊĊĠĠĠ Ġfun ĠSUB SCR IB ED ( accountId : Long ) Ġ= ĠSql . IF NULL ("( SELECT Ġ${ T Ch ats Subscriptions . subscribed } ĠFROM Ġ${ T Ch ats Subscriptions . NAME } Ġas Ġt ĠWHERE Ġt .${ T Ch ats Subscriptions . chat _ type } =$ NAME .$ type ĠAND Ġt .${ T Ch ats Subscriptions . target _ id } =$ NAME .$ id ĠAND Ġt .${ T Ch ats Subscriptions . account _ id } =$ accountId )", ĠĠ 0 ) ĊĠĠĠ Ġfun ĠMEMBER _ STATUS ( accountId : Long ) Ġ= ĠSql . IF NULL ("( SELECT Ġ${ T Ch ats Subscriptions . member _ status } ĠFROM Ġ${ T Ch ats Subscriptions . NAME } Ġas Ġt ĠWHERE Ġt .${ T Ch ats Subscriptions . chat _ type } =$ NAME .$ type ĠAND Ġt .${ T Ch ats Subscriptions . target _ id } =$ NAME .$ id ĠAND Ġt .${ T Ch ats Subscriptions . account _ id } =$ accountId )", ĠĠ 0 ) ĊĠĠĠ Ġfun ĠREAD _ DATE ( accountId : Long ) Ġ= ĠSql . IF NULL ("( SELECT Ġ${ T Ch ats Subscriptions . read _ date } ĠFROM Ġ${ T Ch ats Subscriptions . NAME } Ġas Ġt ĠWHERE Ġt .${ T Ch ats Subscriptions . chat _ type } =$ NAME .$ type ĠAND Ġt .${ T Ch ats Subscriptions . target _ id } =$ NAME .$ id ĠAND Ġt .${ T Ch ats Subscriptions . account _ id } =$ accountId )", ĠĠ 0 ) ĊĠĠĠ Ġfun ĠEXIT _ DATE ( accountId : Long ) Ġ= ĠSql . IF NULL ("( SELECT Ġ${ T Ch ats Subscriptions . exit _ date } ĠFROM Ġ${ T Ch ats Subscriptions . NAME } Ġas Ġt ĠWHERE Ġt .${ T Ch ats Subscriptions . chat _ type } =$ NAME .$ type ĠAND Ġt .${ T Ch ats Subscriptions . target _ id } =$ NAME .$ id ĠAND Ġt .${ T Ch ats Subscriptions . account _ id } =$ accountId )", ĠĠ 0 ) ĊĠĠĠ Ġfun ĠNEW _ MESSAGES ( accountId : Long ) Ġ= ĠSql . IF NULL ("( SELECT Ġ${ T Ch ats Subscriptions . new _ messages } ĠFROM Ġ${ T Ch ats Subscriptions . NAME } Ġas Ġt ĠWHERE Ġt .${ T Ch ats Subscriptions . chat _ type } =$ NAME .$ type ĠAND Ġt .${ T Ch ats Subscriptions . target _ id } =$ NAME .$ id ĠAND Ġt .${ T Ch ats Subscriptions . account _ id } =$ accountId )", ĠĠ 0 ) ĊĠĠĠ Ġfun ĠLAST _ MESSAGE _ ID ( accountId : Long ) Ġ= ĠSql . IF NULL ("( SELECT Ġ${ T Ch ats Subscriptions . last _ message _ id } ĠFROM Ġ${ T Ch ats Subscriptions . NAME } Ġas Ġt ĠWHERE Ġt .${ T Ch ats Subscriptions . chat _ type } =$ NAME .$ type ĠAND Ġt .${ T Ch ats Subscriptions . target _ id } =$ NAME .$ id ĠAND Ġt .${ T Ch ats Subscriptions . account _ id } =$ accountId ) Ġ${ Sql . LIMIT } Ġ 0 , 1 )", ĠĠ 0 ) ĊĠĠĠ Ġfun ĠLAST _ MESSAGE _ ID _ ANY _ ACCOUNT () Ġ= ĠSql . IF NULL ("( SELECT Ġ${ T Ch ats Subscriptions . last _ message _ id } ĠFROM Ġ${ T Ch ats Subscriptions . NAME } Ġas Ġt ĠWHERE Ġt .${ T Ch ats Subscriptions . chat _ type } =$ NAME .$ type ĠAND Ġt .${ T Ch ats Subscriptions . target _ id } =$ NAME .$ id ĠAND Ġt .${ T Ch ats Subscriptions . member _ status } =${ API . CHAT _ MEMBER _ STATUS _ ACTIVE } Ġ${ Sql . LIMIT } Ġ 0 , 1 )", ĠĠ 0 ) Ċ Ċ } Ċ