JabberProtocol.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright 2010, Pier Luigi Fiorini. All rights reserved.
  3. * Distributed under the terms of the GPL v2 License.
  4. *
  5. * Authors:
  6. * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
  7. */
  8. #include "JabberProtocol.h"
  9. #include <Catalog.h>
  10. #include <Resources.h>
  11. #include <libinterface/BitmapUtils.h>
  12. #undef B_TRANSLATION_CONTEXT
  13. #define B_TRANSLATION_CONTEXT "JabberProtocol"
  14. JabberProtocol::JabberProtocol()
  15. : JabberHandler()
  16. {
  17. }
  18. JabberProtocol::~JabberProtocol()
  19. {
  20. }
  21. const char*
  22. JabberProtocol::Signature() const
  23. {
  24. return "xmpp";
  25. }
  26. const char*
  27. JabberProtocol::FriendlySignature() const
  28. {
  29. return "XMPP";
  30. }
  31. BBitmap*
  32. JabberProtocol::Icon() const
  33. {
  34. return ReadNodeIcon(fPath.Path(), B_LARGE_ICON, true);
  35. }
  36. BMessage
  37. JabberProtocol::SettingsTemplate(const char* name)
  38. {
  39. if (strcmp(name, "account") == 0)
  40. return JabberHandler::_SettingsTemplate(B_TRANSLATE("XMPP identifier:"),
  41. true);
  42. if (strcmp(name, "join_room") == 0 || strcmp(name, "create_room") == 0)
  43. return JabberHandler::_RoomTemplate();
  44. if (strcmp(name, "roster") == 0)
  45. return JabberHandler::_RosterTemplate();
  46. else
  47. return BMessage();
  48. }
  49. void
  50. JabberProtocol::OverrideSettings()
  51. {
  52. }
  53. BString
  54. JabberProtocol::ComposeJID() const
  55. {
  56. BString jid(fUsername);
  57. if (jid.FindLast("@") < 0)
  58. jid << "@" << fServer;
  59. jid << "/" << fResource;
  60. return jid;
  61. }