ChannelRefresher.cpp 782 B

123456789101112131415161718192021222324252627282930313233
  1. #include "main.h"
  2. #include "ChannelRefresher.h"
  3. #include <algorithm>
  4. #include "./subscriptionView.h"
  5. using namespace Nullsoft::Utility;
  6. void ChannelRefresher::BeginChannelSync()
  7. {}
  8. void ChannelRefresher::NewChannel(const Channel &newChannel)
  9. {
  10. AutoLock lock (channels LOCKNAME("ChannelRefresher::NewChannel"));
  11. ChannelList::iterator found;
  12. for (found=channels.begin();found!=channels.end(); found++)
  13. {
  14. if (!wcscmp(found->url, newChannel.url))
  15. break;
  16. }
  17. if (found != channels.end())
  18. {
  19. // todo, redo category indexing as necessary.
  20. found->UpdateFrom(newChannel);
  21. found->lastUpdate = _time64(0);
  22. found->needsRefresh = false;
  23. }
  24. }
  25. void ChannelRefresher::EndChannelSync()
  26. {
  27. HWND wnd = SubscriptionView_FindWindow();
  28. SubscriptionView_RefreshChannels(wnd, TRUE);
  29. }