Guest User

Untitled

a guest
Jun 19th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #import "PingAdiumPlugin.h"
  2.  
  3. @implementation PingAdiumPlugin
  4.  
  5. - (void)installPlugin {
  6. [[adium contentController] registerContentFilter:self ofType:AIFilterContent direction:AIFilterIncoming];
  7. }
  8.  
  9. - (void)uninstallPlugin {
  10. [[adium contentController] unregisterContentFilter:self];
  11. }
  12.  
  13. - (NSAttributedString *)filterAttributedString:(NSAttributedString *)inAttributedString context:(id)context {
  14. if ([[inAttributedString string] isEqual:@"ping"]) {
  15. AIContentMessage *msg = context;
  16. AIContentMessage *message = [[AIContentMessage alloc]
  17. initWithChat:[msg chat]
  18. source:[msg destination]
  19. destination:[msg source]
  20. date:[msg date]
  21. message:@"pong"];
  22. [msg sendMessageObject:message];
  23. [message release];
  24. }
  25.  
  26. return inAttributedString;
  27. }
  28.  
  29. - (float)filterPriority {
  30. return DEFAULT_FILTER_PRIORITY;
  31. }
  32.  
  33. @end
Add Comment
Please, Sign In to add comment