summaryrefslogtreecommitdiff
path: root/plexgdm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plexgdm.cpp')
-rw-r--r--plexgdm.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/plexgdm.cpp b/plexgdm.cpp
index cdc1339..a3b3de2 100644
--- a/plexgdm.cpp
+++ b/plexgdm.cpp
@@ -164,7 +164,7 @@ void plexgdm::discover()
bool flag = true;
// Check for duplicates
for(std::vector<PlexServer>::iterator s_it = m_vServers.begin(); s_it != m_vServers.end(); ++s_it) {
- if(s_it->GetIpAdress() == host) {
+ if(s_it->GetHost() == host) {
flag = false;
s_it->ParseData(data, host);
dsyslog("[plex] Server Updated: %s", host.c_str());
@@ -194,7 +194,7 @@ void plexgdm::stopRegistration()
PlexServer* plexgdm::GetServer(std::string ip, int port)
{
for(std::vector<PlexServer>::iterator s_it = m_vServers.begin(); s_it != m_vServers.end(); ++s_it) {
- if(s_it->GetIpAdress() == ip && s_it->GetPort() == port) {
+ if(s_it->GetHost() == ip && s_it->GetPort() == port) {
return &(*s_it);
}
}
@@ -208,4 +208,26 @@ PlexServer* plexgdm::GetFirstServer()
else return NULL;
}
+PlexServer* plexgdm::GetServer(std::string uuid)
+{
+ for(std::vector<PlexServer>::iterator s_it = m_vServers.begin(); s_it != m_vServers.end(); ++s_it) {
+ if(s_it->GetUuid() == uuid ){
+ return &(*s_it);
+ }
+ }
+ return NULL;
+}
+
+void plexgdm::AddServer(PlexServer server)
+{
+ for(std::vector<PlexServer>::iterator s_it = m_vServers.begin(); s_it != m_vServers.end(); ++s_it) {
+ if(s_it->GetUuid() == server.GetUuid() ){
+ dsyslog("[plex] Server already in list: %s", server.GetUri().c_str());
+ return;
+ }
+ }
+ m_vServers.push_back(server);
+ isyslog("[plex] New Server Added: %s", server.GetUri().c_str());
+}
+
} // namespace