doNotifyChannel ::
  UserInfo ->
  Identifier ->
  ByteString ->
  IrcConnection ->
  Logic IrcConnection

doNotifyChannel who chan msg conn =
  do stamp <- getStamp
     let (statusmsg, chan') = splitStatusMsg chan conn
     let ty = case parseCtcpCommand msg of
                Nothing                 -> NoticeMsgType (asUtf8 msg)
                Just (command , args  ) -> CtcpRspMsgType command args
         modes = view (connChannels . ix chan' . chanUsers . ix (userNick who)) conn
         mesg = defaultIrcMessage
               { _mesgType = ty
               , _mesgSender = who
               , _mesgStamp = stamp
               , _mesgStatus = statusmsg
               , _mesgModes  = modes
               }
     recordMessage mesg chan' conn
doNotifyChannel ::
  UserInfo ->
  Identifier ->
  ByteString ->
  IrcConnection ->
  Logic IrcConnection
doNotifyChannel who chan msg conn =
  do stamp <- getStamp
     let (statusmsg, chan') = splitStatusMsg chan conn
     let ty = case parseCtcpCommand msg of
                Nothing                 -> NoticeMsgType (asUtf8 msg)
                Just (command , args  ) -> CtcpRspMsgType command args
         modes = view (connChannels . ix chan' . chanUsers . ix (userNick who)) conn
         mesg = defaultIrcMessage
               { _mesgType = ty
               , _mesgSender = who
               , _mesgStamp = stamp
               , _mesgStatus = statusmsg
               , _mesgModes  = modes
               }
     recordMessage mesg chan' conn
doNotifyChannel who chan msg conn =
  do stamp <- getStamp
     let (statusmsg, chan') = splitStatusMsg chan conn
     let ty = case parseCtcpCommand msg of
                Nothing                 -> NoticeMsgType (asUtf8 msg)
                Just (command , args  ) -> CtcpRspMsgType command args
         modes = view (connChannels . ix chan' . chanUsers . ix (userNick who)) conn
         mesg = defaultIrcMessage
               { _mesgType = ty
               , _mesgSender = who
               , _mesgStamp = stamp
               , _mesgStatus = statusmsg
               , _mesgModes  = modes
               }
     recordMessage mesg chan' conn