]> cgit.babelmonkeys.de Git - mpdbot.git/blobdiff - src/mpdbot.m
Auto-confirm subscription requests
[mpdbot.git] / src / mpdbot.m
index f55e4b77ec3b23f6cd8e7130b46cba15a8bab010..1c7ab7d4ac18cdcee606e4230ada7da49953cd92 100644 (file)
@@ -129,7 +129,13 @@ OF_APPLICATION_DELEGATE(AppDelegate)
 -   (void)connection: (XMPPConnection*)conn
   didReceivePresence: (XMPPPresence*)pres
 {
-       of_log(@"Presence: %@", pres);
+       if ([pres.type isEqual: @"subscribe"]) {
+               XMPPPresence *answer;
+               answer = [XMPPPresence presenceWithType: @"subscribed"
+                                                    ID: pres.ID];
+               answer.to = [XMPPJID JIDWithString: [pres.from bareJID]];
+               [conn sendStanza: answer];
+       }
 }
 
 - (void)connectionWasClosed: (XMPPConnection*)conn