Sending ics file by email, it shows three options as Yes|Maybe|No. I want to get only one button as "Add to calendar" - icalendar

Sending an email by Laravel application, I am creating and sending an iCalendar event as an attachment. Opening the sent email in Outlook(Office 365) I see three buttons as Yes|Maybe|No. If users clicks on Yes option, it saves the event in her/his calendar. I don't want to have these three buttons. Instead I want a single button as "Add to calendar".
When I change the method from REQUEST to CANCEL, it shows only one button as "Remove from calendar".
BEGIN:VCALENDAR
VERSION:2.0
PRODID:event.foo.bar
METHOD:REQUEST
BEGIN:VEVENT
UID:e1#ctsi.eve.test
SEQUENCE:1
SUMMARY:Lorem Ipsum
DTSTART:20190418T095700Z
DTEND:20190418T115700Z
DESCRIPTION:Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent id sapien nisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam porttitor nec nulla consectetur interdum.
LOCATION:Toronto, Canada
DTSTAMP:20190411T095811
ATTENDEE;CN=John Doe;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE:mailto:foo#bar.ca
END:VEVENT
END:VCALENDAR

Bahman,
Use method 'PUBLISH' if you just want them to add it to the calendar.
REQUEST is when you are sending an invitation and requesting their attendance.
See https://www.rfc-editor.org/rfc/rfc5546#section-1.4

Related

Saving NSDictionary in Core Data using Swift

I did search many answers here that carry the same question title as mine, they're mostly in Obj-C and/or outdated. So please try to be patient...
I need to save an API response in Core Data for offline use.
Here is the response:
{
"data": [{
"id": 1,
"title": "Lorem Ipsum",
"subtitle": "<p>Deutsches Ipsum Dolor deserunt dissentias Berlin et. Tollit argumentum ius an. Eichh\u00f6rnchen lobortis elaboraret per ne, nam Erbsenz\u00e4hler probatus pertinax, impetus eripuit aliquando Meerschweinchen sea. Diam scripserit no vis, Brezel meis suscipit ea. Eam ea Fernweh eleifend, ad blandit voluptatibus sed, Schnaps eius consul sanctus vix. Cu Aufschnitt legimus veritus vim<\/p><p>Deutsches Ipsum Dolor deserunt dissentias Berlin et. Tollit argumentum ius an. Eichh\u00f6rnchen lobortis elaboraret per ne, nam Erbsenz\u00e4hler probatus pertinax, impetus eripuit aliquando Meerschweinchen sea. Diam scripserit no vis, Brezel meis suscipit ea. Eam ea Fernweh eleifend, ad blandit voluptatibus sed, Schnaps eius consul sanctus vix. Cu Aufschnitt legimus veritus vim<\/p>",
"text": "<p>Deutsches Ipsum Dolor deserunt dissentias Berlin et. Tollit argumentum ius an. Eichh\u00f6rnchen lobortis elaboraret per ne, nam Erbsenz\u00e4hler probatus pertinax, impetus eripuit aliquando Meerschweinchen sea. Diam scripserit no vis, Brezel meis suscipit ea. Eam ea Fernweh eleifend, ad blandit voluptatibus sed, Schnaps eius consul sanctus vix. Cu Aufschnitt legimus veritus vim<\/p><p>Deutsches Ipsum Dolor deserunt dissentias Berlin et. Tollit argumentum ius an. Eichh\u00f6rnchen lobortis elaboraret per ne, nam Erbsenz\u00e4hler probatus pertinax, impetus eripuit aliquando Meerschweinchen sea. Diam scripserit no vis, Brezel meis suscipit ea. Eam ea Fernweh eleifend, ad blandit voluptatibus sed, Schnaps eius consul sanctus vix. Cu Aufschnitt legimus veritus vim<\/p><p>Deutsches Ipsum Dolor deserunt dissentias Berlin et. Tollit argumentum ius an. Eichh\u00f6rnchen lobortis elaboraret per ne, nam Erbsenz\u00e4hler probatus pertinax, impetus eripuit aliquando Meerschweinchen sea. Diam scripserit no vis, Brezel meis suscipit ea. Eam ea Fernweh eleifend, ad blandit voluptatibus sed, Schnaps eius consul sanctus vix. Cu Aufschnitt legimus veritus vim<\/p>",
"created_at": "2019-11-11 09:52:11",
"updated_at": "2019-11-11 09:52:11",
"deleted_at": null
}]
}
I've no problem viewing this response using WKWebKit this way:
class WebVC: UIViewController {
var selectedIndex = 0
var detailsArray = [NSDictionary]()
#IBOutlet weak var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
setupPage()
}
private func setupPage() {
self.showAnimate()
self.view.backgroundColor = UIColor.black.withAlphaComponent(0.8)
showWebViewData()
}
func showWebViewData() {
let title = "<h2>\(detailsArray[selectedIndex]["title"] ?? "")</h2>";
let htmlstr = "\(title) \(detailsArray[selectedIndex]["subtitle"] ?? "") \(detailsArray[selectedIndex]["text"] ?? "")"
print(htmlstr)
let str = "<!DOCTYPE html> <html> <head> <link href='https://fonts.googleapis.com/css?family=Fira Sans Condensed' rel='stylesheet'> <style> body {font-family: 'Fira Sans Condensed';} .bg-white { background: rgba(255, 255, 255, 0.6); border-radius:40px; padding: 20px; }html { padding: 10px;} h2 {font-size:40pt; color:#707070;} p{font-size:26pt; {font-family: 'Fira Sans', sans-serif;}.bold{font-weight:bold;}.italic{font-style: italic;}.oblique{font-style: oblique;}} strong{font-size:30pt}</style> </head> <body><div class='bg-white'>\(htmlstr) </div> </body> </html>"
webView.loadHTMLString(str, baseURL: nil)
webView.backgroundColor = .clear
webView.isOpaque = false
}
But I'm having troubles saving the response in Core Data.
I created an entity with one Transformable attribute to save the whole thing but it failed. I also tried to create three attributes: title, subtitle and text as Strings but it also failed.
func saveInfoInCoreData(Emeregnecyinfos: [EmergencyInformation] ) {
// Deletes Information Before Adding New One
delete Info()
for info in Emeregnecyinfos {
let entity = NSEntityDescription.entity(forEntityName: "Info", in: Context)
let information = NSManagedObject(entity: entity!, insertInto: PrivateContext)
information.setValue(info.title, forKey: "title")
information.setValue(info.subtitle, forKey: "subtitle")
information.setValue(info.text, forKey: "text")
do {
try PrivateContext.save()
} catch {
print("Failed Saving Information!")
}
}
}
Any help would be extremely appreciated with code examples. Thanks!

BsonInvalidOperationException: readStartDocument can only be called when CurrentBSONType is DOCUMENT, not when CurrentBSONType is STRING

Data from source system -
abc#abc.com # kafka-avro-console-consumer --bootstrap-server
localhost:9092 --topic TTDF.TCDCPOC_DATA_TYPES --from-beginning
--property print.key=true --property print.value=true --property key.deserializer=org.apache.kafka.common.serialization.StringDeserializer
"57508564" {"data":{"SEQNO":{"int":57508564},"TEXT":{"string":"Lorem ipsum dolor sit amet,"},"BIGNUM":{"long":11122233344447},"BINOBJ":{"bytes":"#~¦`¬| DATA IS STORED AS BINARY|>"},"CHAROBJ":{"string":"<text>THIS DATA IS STORED AS CLOB</text>"},"FLOATNUM":{"double":6.62607015E-34},"CHARVAR":{"string":"consectetur adipiscing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."}},"headers":{"operation":"REFRESH","changeSequence":"","timestamp":"","streamPosition":"","transactionId":"","changeMask":null,"columnMask":null}}
^CProcessed a total of 6 messages
Schema registry -
{
"subject": "TTDF.TCDCPOC_DATA_TYPES-value",
"version": 3,
"id": 12,
"schema": "{"type":"record","name":"DataRecord","fields":[{"name":"data","type":{"type":"record","name":"Data","fields":[{"name":"SEQNO","type":["null","int"],"default":null},{"name":"TEXT","type":["null","string"],"default":null},{"name":"BIGNUM","type":["null","long"],"default":null},{"name":"BINOBJ","type":["null","bytes"],"default":null},{"name":"CHAROBJ","type":["null","string"],"default":null},{"name":"FLOATNUM","type":["null","double"],"default":null},{"name":"CHARVAR","type":["null","string"],"default":null}]}},{"name":"headers","type":{"type":"record","name":"Headers","fields":[{"name":"operation","type":{"type":"enum","name":"operation","symbols":["INSERT","UPDATE","DELETE","REFRESH"]}},{"name":"changeSequence","type":"string"},{"name":"timestamp","type":"string"},{"name":"streamPosition","type":"string"},{"name":"transactionId","type":"string"},{"name":"changeMask","type":["null","bytes"]},{"name":"columnMask","type":["null","bytes"]}]}}]}"
}
Errors -
[2019-02-12 12:28:48,364] ERROR WorkerSinkTask{id=mongo-0} Task threw an uncaught and unrecoverable exception. Task is being killed and will not recover until manually restarted. (org.apache
.kafka.connect.runtime.WorkerSinkTask:584)
org.bson.BsonInvalidOperationException: readStartDocument can only be called when CurrentBSONType is DOCUMENT, not when CurrentBSONType is STRING.
at org.bson.AbstractBsonReader.verifyBSONType(AbstractBsonReader.java:690)
at org.bson.AbstractBsonReader.checkPreconditions(AbstractBsonReader.java:722)
at org.bson.AbstractBsonReader.readStartDocument(AbstractBsonReader.java:450)
at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:81)
at org.bson.BsonDocument.parse(BsonDocument.java:62)
at at.grahsl.kafka.connect.mongodb.converter.JsonRawStringRecordConverter.convert(JsonRawStringRecordConverter.java:32)
at at.grahsl.kafka.connect.mongodb.converter.SinkConverter.convert(SinkConverter.java:44)
at at.grahsl.kafka.connect.mongodb.MongoDbSinkTask.lambda$buildWriteModel$3(MongoDbSinkTask.java:186)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at at.grahsl.kafka.connect.mongodb.MongoDbSinkTask.buildWriteModel(MongoDbSinkTask.java:185)
at at.grahsl.kafka.connect.mongodb.MongoDbSinkTask.processSinkRecords(MongoDbSinkTask.java:122)
at at.grahsl.kafka.connect.mongodb.MongoDbSinkTask.lambda$null$0(MongoDbSinkTask.java:111)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at at.grahsl.kafka.connect.mongodb.MongoDbSinkTask.lambda$put$1(MongoDbSinkTask.java:110)
at java.util.HashMap.forEach(HashMap.java:1289)
at at.grahsl.kafka.connect.mongodb.MongoDbSinkTask.put(MongoDbSinkTask.java:109)
at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:564)
at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:322)
at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:225)
at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:193)
at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:175)
at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:219)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[2019-02-12 12:28:48,364] ERROR WorkerSinkTask{id=mongo-0} Task threw an uncaught and unrecoverable exception (org.apache.kafka.connect.runtime.WorkerTask:177)
org.apache.kafka.connect.errors.ConnectException: Exiting WorkerSinkTask due to unrecoverable exception.
at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:586)
at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:322)
at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:225)
at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:193)
Config file -
{
"name": "mongo",
"config": {
"key.converter":"org.apache.kafka.connect.storage.StringConverter",
"internal.key.converter":"org.apache.kafka.connect.storage.StringConverter",
"internal.key.converter.schemas.enable":"false",
"key.converter.schemas.enable": false,
"key.ignore":"true",
"value.converter":"io.confluent.connect.avro.AvroConverter",
"internal.value.converter":"io.confluent.connect.avro.AvroConverter",
"value.converter.schemas.enable": true,
"internal.value.converter.schemas.enable":"true",
"key.converter.schema.registry.url":"http://localhost:8081",
"value.converter.schema.registry.url":"http://localhost:8081",
"connector.class": "at.grahsl.kafka.connect.mongodb.MongoDbSinkConnector",
"topics":"TTDF.TCDCPOC_DATA_TYPES",
"mongodb.connection.uri":"mongodb://xxxx:Password1#xxxx:27017/testdb?authSource=xxx",
"mongodb.collection":"TCDCPOC_DATA_TYPES",
"_comment":"transforms\":\"createKey",
"_comment":"transforms.createKey.type:org.apache.kafka.connect.transforms.Flatten$Value",
"_comment":"transforms.Flatten.delimiter:_",
"_comment":"transforms.createKey.type:io.confluent.connect.transforms.Drop$Key",
"_comment":"transforms.createKey.skip.missing.or.null\":\"true",
"_comment":"transforms.createKey.type\":\"org.apache.kafka.connect.transforms.ValueToKey",
"_comment":"transforms.createKey.fields\":\"data.SEQNO",
"_comment":"transforms.createKey.static.key:test"
}
}

Dividing the texts on Swift

Dividing the texts on Text View/Label in order to be opened in a different modal when clicking on individual sentences.
Etc: according to full stop.
Text in Text View/Label was pulled over via sqlite. I draw data with sqlite and I combine the texts into paragraphs. I want information about that statement to be printed when every sentence is printed. The application is written in swift 4, XCode 9 environment.
Etc article: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ut dui a velit bibendum tincidunt ac non eros. Maecenas vel risus molestie, ultrices turpis quis, mattis lorem. Suspendisse quis ultrices sem.
Separate clicks for all text:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Duis ut dui a velit bibendum tincidunt ac non eros.
Maecenas vel risus molestie, ultrices turpis quis, mattis lorem.
Suspendisse quis ultrices sem.
The text needs to be in paragraph format. This is an article. My purpose is not to show it in the form of separate cues. My purpose is to connect each event separately to each event.
I used FRHyperLabel but not working... FRHyperLabel in scroolview. The click is working but it works wrong. For example; I'm clicking the 2nd sentence, but it's acting like 1st sentence.
for eleman in articleSentenceList{
let handler = {
(hyperLabel: FRHyperLabel?, substring: String?) -> Void in
let controller = UIAlertController(title: substring, message: eleman.v1, preferredStyle: UIAlertControllerStyle.alert)
controller.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil))
self.present(controller, animated: true, completion: nil)
}
let denemeString:String = eleman.v2
let substring = denemeString[denemeString.startIndex..<denemeString.index(denemeString.startIndex, offsetBy: denemeString.count)]
translateList.append(String(substring))
txtTitle.setLinksForSubstrings([translateList.last!], withLinkHandler: handler)
}

How can I add language-agnostic snippets in vscode?

As an example I would like to add "lorem ipsum" as a snippet, so I can quickly insert it where I want. I don't want it do be tied to a specific language, as I might use it in multiple places like HTML, Jade, even JS/TS.
Is there like a global.json for snippets, or any other way to do this?
Global snippets were added in v1.10 Feb., 2018 see global snippets
VS Code now supports global snippets meaning snippets that aren't scoped to a single language but can target any kind of files. Using the Preferences: Configure User Snippets command, select the New Global Snippets file... option which will open a .code-snippets file for new snippets. Use the scope attribute to list the languages that are targeted by a snippet. For instance, the snippet below can add a copyright header for JavaScript and TypeScript files:
From the documentation:
"JS & TS Stub": {
"scope": "javascript,typescript",
"prefix": "stub",
"body": [
"/*--------------------------------------------------------------",
" * Copyright (c) Your Corporation. All rights reserved.",
" * Licensed under the MIT License.",
" *-------------------------------------------------------------*/",
"",
"'use strict';",
"",
"$0"
],
"description": "Insert Copyright Statement"
}
VS Code doesn't have a global scope afaik. However, I made an npm package called Snipster that changes the way you write snippets and allows you to publish a global scope to all languages by naming the snippet with a .all extension. It also works with Atom and Sublime, not just VS Code.
For example:
lorem.all
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ultrices nulla eget lectus pharetra dignissim. Curabitur molestie odio sed odio porttitor efficitur. Nulla vulputate porta quam, nec aliquam nisi gravida ac. Donec quis risus sed odio accumsan commodo id vel enim. Vivamus quam mauris, rutrum at vulputate quis, hendrerit eu velit.

(iOS) recursive vCard-temp request to the jabber server?

I am creating an iphone app with xmpframework, everything works fine, but i would like to update my profile picture with the following code. and i got some incorrect recursive vCard-temp request to the server. But the picture got updated, and notified all friends in my roster.
//I clicked on the button
-(void)updatevCardButtonClicked{
XMPPvCardTemp *vCardTemp = [[[self appDelegate] xmppvCardTempModule] myvCardTemp];
NSLog(#"my vCardTemp: %#", vCardTemp);
NSData *tempImage = [self getDataFromImage:[self resizeImage:userImage]];
[vCardTemp setPhoto: tempImage];
[[[self appDelegate] xmppvCardTempModule]updateMyvCardTemp:vCardTemp];
}
output and explanation below
my vCardTemp: *nil description*
MyApp[60625:6c1b] XMPPvCardCoreDataStorage: Triggering save (pendingRequests=0)
MyApp[60625:207] MyAppDelegate: xmppStream:didReceiveIQ: - E49C843A-5A05-4148-A4CF-B400062A83C0
MyApp[60625:207] MyAppDelegate: xmppStream:didReceivePresence: - <presence xmlns="jabber:client" from="myJabberAccount#127.0.0.1/1948110991326183732515886" to="myJabberAccount#127.0.0.1/1948110991326183732515886">
<status>At work</status>
<x xmlns="vcard-temp:x:update">
<photo>1f6401ddea76826fddc4cd7ddc17741db6c9dabc</photo>
</x>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="></c>
<x xmlns="vcard-temp:x:update">
<photo>c3b2d65259a4fc1d37e56777697d4f5a9730fb03</photo></x><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="></c>
</presence>
MyApp[60625:5323] XMPPRosterCoreDataStorage: handlePresence:xmppStream:
//repeat start from here, and the DidReceivePresence: will grow into tons of lines with the samthing
MyApp[60625:207] XMPPRosterCoreDataStorage: userForJID:xmppStream:managedObjectContext:
MyApp[60625:1e0b] XMPPRosterCoreDataStorage: userForJID:xmppStream:managedObjectContext:
MyApp[60625:207] XMPPRosterCoreDataStorage: resourceForJID:xmppStream:managedObjectContext:
MyApp[60625:5323] XMPPvCardCoreDataStorage: Triggering save (pendingRequests=0)
MyApp[60625:207] MyAppDelegate: xmppStream:didReceiveIQ: - (null)
MyApp[60625:1e0b] XMPPvCardCoreDataStorage: Triggering save (pendingRequests=0)
MyApp[60625:207] MyAppDelegate: xmppStream:didReceivePresence: - <presence xmlns="jabber:client" from="myJabberAccount#127.0.0.1/1948110991326183732515886" to="myJabberAccount#127.0.0.1/1948110991326183732515886">
<status>At work</status>
<x xmlns="vcard-temp:x:update">
<photo>1f6401ddea76826fddc4cd7ddc17741db6c9dabc</photo>
</x>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="></c>
<x xmlns="vcard-temp:x:update">
<photo>c3b2d65259a4fc1d37e56777697d4f5a9730fb03</photo>
</x>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="></c>
<x xmlns="vcard-temp:x:update">
<photo>c3b2d65259a4fc1d37e56777697d4f5a9730fb03</photo>
</x>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4=">
</c>
</presence>
//repeat the above in the rest of the output with more and more "vcard-temp:x:update"
what i found so far, the below cause this problem, but i can't figure out where i can fix it.
//i found that these two "SEND" cause the problem, the app just keep sending these two
SEND: <iq type="get" to="myJabberAccount#127.0.0.1"><vCard xmlns="vcard-temp"/></iq>
SEND: <presence>
<x xmlns="vcard-temp:x:update">
<photo>1f6401ddea76826fddc4cd7ddc17741db6c9dabc</photo>
</x>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="/>
<x xmlns="vcard-temp:x:update">
<photo>1f6401ddea76826fddc4cd7ddc17741db6c9dabc</photo>
</x>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="/>
<x xmlns="vcard-temp:x:update">
<photo>f93ee3918c7baaf095edb9f6bede892c603161af</photo>
</x>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="/>
<x xmlns="vcard-temp:x:update">
<photo>f93ee3918c7baaf095edb9f6bede892c603161af</photo>
</x>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="/>
</presence>
//this presence keep growing as you can see the repeated parts
I have been trying to tackle this problem for quite some time. Let me know if this works for you. Here's my explanation:
Whenever you send a presence element via xmppStream, it caches a copy of it under the "myPresence" instance variable.
If you look for the following method in XMPPStream.m:
- (void)continueSendElement:(NSXMLElement *)element withTag:(long)tag
there is a comment about 10-20 lines down that says:
// Update myPresence if this is a normal presence element.
// In other words, ignore presence subscription stuff, MUC room stuff, etc.
When the XMPPvCardAvatarModule class updates the vcard, it introduces things like the <x> and the <c> (capability) tags that pollutes the normal presence element.
To fix this, we need to clean up those unnecessary tags. Here is a section of my edited code:
else if ([element isKindOfClass:[XMPPPresence class]])
{
// Update myPresence if this is a normal presence element.
// In other words, ignore presence subscription stuff, MUC room stuff, etc.
XMPPPresence *presence = (XMPPPresence *)element;
// We use the built-in [presence type] which guarantees lowercase strings,
// and will return #"available" if there was no set type (as available is implicit).
NSString *type = [presence type];
if ([type isEqualToString:#"available"] || [type isEqualToString:#"unavailable"])
{
NSArray *vCardXElem = [presence elementsForName:#"x"];
NSArray *capabilitiesHash = [presence elementsForName:#"c"];
for (NSXMLElement *x in vCardXElem)
{
[presence removeChildAtIndex:[x index]];
}
for (NSXMLElement *c in capabilitiesHash)
{
[presence removeChildAtIndex:[c index]];
}
if ([presence toStr] == nil && myPresence != presence)
{
myPresence = presence;
}
}
[multicastDelegate xmppStream:self didSendPresence:(XMPPPresence *)element];
}