anchor.diff:         fun current_uid_asserts/1]}].
   
   update_uid_internal_asserts(Accounts) ->
  -    [?_assertMatch({state, _, _, LastUid, _} when is_integer(LastUid),
  -                   switchboard_operator:update_uid_internal(
  -                    {state, A, M, none, none})) %% This is sketchy....
  +    [?_assertMatch(#state{last_uid=LastUid} when is_integer(LastUid),
  +                   update_uid_internal(#state{account=A, mailbox=M}))
        || {A, M} <- Accounts].
   
   current_uid_asserts(Accounts) ->
  -    [?_assertMatch({ok, _},
  -                   switchboard_operator:current_uid(A, M)) || {A, M} <- Accounts].
  +    [?_assertMatch({ok, _}, current_uid(A, M)) || {A, M} <- Accounts].
   
   -endif.
  
positive.code:          terminate/2]).
  
  
  -ifdef(TEST).
  -export([update_uid_internal/1,
           current_uid/2]).
  -endif.
  
  
  %% Records
  -record(state, {account :: imap:account(),
                  mailbox :: imap:mailbox(),
  
negative.code: handle_info(timeout, State) ->
      ok = update_uid(self()),
      {noreply, State};
  handle_info({idle, {'*', [_, Notification]}}, State)
    when Notification =:= <<"EXISTS">> orelse Notification =:= <<"EXPUNGE">> ->
      {noreply, update_uid_internal(State)};
  handle_info({idle, {'+', [<<"idling">>]}}, State) ->
      % Set the initial UID values.
      {noreply, update_uid_internal(State)};
  handle_info({idle, Msg}, State) ->
      lager:warning("Unrecognized msg: ~p", [Msg]),
      {noreply, State}.
  
  
  