Overview
Comment: | DiscoEntity: Answer to requests send to the caps node |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
31e88fde564e0084bba648bfe2a5db49 |
User & Date: | florob@babelmonkeys.de on 2013-03-24 15:33:42 |
Other Links: | manifest | tags |
Context
2013-03-26
| ||
18:11 | Fix a use after free() bug in XMPPSCRAMAuth check-in: aa2fb6642f user: florob@babelmonkeys.de tags: trunk | |
2013-03-24
| ||
15:33 | DiscoEntity: Answer to requests send to the caps node check-in: 31e88fde56 user: florob@babelmonkeys.de tags: trunk | |
2013-03-23
| ||
22:06 | Add XMPPDisco*.h to ObjXMPP.h, remove debug code check-in: 479c1259df user: florob@babelmonkeys.de tags: trunk | |
Changes
Modified src/XMPPDiscoEntity.h from [a569874688] to [feea2c657c].
︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | * \brief A class representing an entity responding to Service Discovery * queries */ @interface XMPPDiscoEntity: XMPPDiscoNode <XMPPConnectionDelegate> { OFMutableDictionary *_discoNodes; XMPPConnection *_connection; OFString *_capsNode; } #ifdef OF_HAVE_PROPERTIES /** * \brief The XMPPDiscoNodes this entity provides Services Discovery * responses for * * This usually contains at least all immediate child nodes, but may contain * any number of nodes nested more deeply. */ @property (readonly) OFDictionary *discoNodes; /// \brief The node advertised for the entity's capabilites @property (readonly) OFString *capsNode; #endif /** * \brief Creates a new autoreleased XMPPDiscoEntity with the specified * connection. * * \param connection The XMPPConnection to serve responses on. * This must already be bound to a resource) * \return A new autoreleased XMPPDiscoEntity */ + discoEntityWithConnection: (XMPPConnection*)connection; /** * \brief Creates a new autoreleased XMPPDiscoEntity with the specified * connection. * * \param connection The XMPPConnection to serve responses on. * This must already be bound to a resource) * \param capsNode The node advertised for the entity's capabilites * \return A new autoreleased XMPPDiscoEntity */ + discoEntityWithConnection: (XMPPConnection*)connection capsNode: (OFString*)capsNode; /** * \brief Initializes an already allocated XMPPDiscoEntity with the specified * connection. * * \param connection The XMPPConnection to serve responses on. * This must already be bound to a resource) * \return An initialized XMPPDiscoEntity */ - initWithConnection: (XMPPConnection*)connection; /** * \brief Initializes an already allocated XMPPDiscoEntity with the specified * connection. * * \param connection The XMPPConnection to serve responses on. * This must already be bound to a resource) * \param capsNode The node advertised for the entity's capabilites * \return An initialized XMPPDiscoEntity */ - initWithConnection: (XMPPConnection*)connection capsNode: (OFString*)capsNode; /** * \brief Adds a XMPPDiscoNode to provide responses for. * * \param node The XMPPDiscoNode to provide responses for */ - (void)addDiscoNode: (XMPPDiscoNode*)node; /** * \brief Calculates the Entity Capabilities Hash of the entity * * \return A OFString containing the capabilities hash */ - (OFString*)capsHash; - (OFDictionary*)discoNodes; - (OFString*)capsNode; @end |
Modified src/XMPPDiscoEntity.m from [59e69ee9cc] to [98c4d4ca4a].
︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | + + + + + + + + + + + + + + + | #import "namespaces.h" @implementation XMPPDiscoEntity + discoEntityWithConnection: (XMPPConnection*)connection { return [[[self alloc] initWithConnection: connection] autorelease]; } + discoEntityWithConnection: (XMPPConnection*)connection capsNode: (OFString*)capsNode { return [[[self alloc] initWithConnection: connection capsNode: capsNode] autorelease]; } - initWithConnection: (XMPPConnection*)connection { return [self initWithConnection: connection capsNode: nil]; } - initWithConnection: (XMPPConnection*)connection capsNode: (OFString*)capsNode { self = [super initWithJID: [connection JID] node: nil]; @try { _discoNodes = [OFMutableDictionary new]; _connection = connection; _capsNode = [capsNode copy]; [_connection addDelegate: self]; } @catch (id e) { [self release]; @throw e; } |
︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | + + + + + | } - (void)addDiscoNode: (XMPPDiscoNode*)node { [_discoNodes setObject: node forKey: [node node]]; } - (OFString*)capsNode { OF_GETTER(_capsNode, YES); } - (OFString*)capsHash { OFMutableString *caps = [OFMutableString string]; OFEnumerator *enumerator; XMPPDiscoIdentity *identity; OFString *feature; |
︙ | |||
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | + + + + + + + | query = [IQ elementForName: @"query" namespace: XMPP_NS_DISCO_INFO]; if (query != nil) { OFString *node = [[query attributeForName: @"node"] stringValue]; if (node == nil) return [self XMPP_handleInfoIQ: IQ connection: connection]; OFString *capsNode = [_capsNode stringByAppendingFormat: @"#%@", [self capsHash]]; if ([capsNode isEqual: node]) return [self XMPP_handleInfoIQ: IQ connection: connection]; XMPPDiscoNode *responder = [_discoNodes objectForKey: node]; if (responder != nil) return [responder XMPP_handleInfoIQ: IQ connection: connection]; |
︙ |
Modified src/XMPPDiscoNode.m from [49dce66da1] to [bbd32eb970].
︙ | |||
186 187 188 189 190 191 192 | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | - - - - - - | connection: (XMPPConnection*)connection { XMPPIQ *resultIQ; OFXMLElement *response; OFEnumerator *enumerator; OFString *feature; XMPPDiscoIdentity *identity; |
︙ |