Settings Text String as Variable in If Statement

Publish expects the topic in a char array. Not a String.

char mediacenter = "server1";
is not the same as
String(server) = "server1";