+// update_counterunseen is used to reset the counter to zero from Windows Phone app
+function windowsphonepush_updatecounterunseen()
+{
+ if (!local_user()) {
+ return "Not Authenticated";
+ }
+
+ // no updating if user hasn't enabled the plugin
+ $enable = PConfig::get(local_user(), 'windowsphonepush', 'enable');
+ if (!$enable) {
+ return "Plug-in not enabled";
+ }
+
+ PConfig::set(local_user(), 'windowsphonepush', 'counterunseen', 0);
+ return "Counter set to zero";
+}
+
+/* helper function to login to the server with the specified Network credentials