Commit Graph

173 Commits

Author SHA1 Message Date
Martin Dosch
6138e9dbe5 Harmonize newlines
Now there should be no more newlines in between any stanza and a
newline after every stanza.
This should not affect functionality but is looking better if
stanzas are printed for debugging.
2023-08-14 10:28:33 +02:00
Martin
98ff0d4df7
Rework printing of sent stanzas when debug is enabled (#148)
* Rework printing of sent stanzas when debug is enabled

This got reworked to also work with multiple connections
as pointed out by @vcabbage in
https://github.com/mattn/go-xmpp/pull/141#issuecomment-1557334066

* Remove StanzaWriter.
2023-07-28 23:42:12 +09:00
Martin
bef3e549f7
add scram auth (#147)
* Fix syntax errors.

* gofmt

* Add SCRAM-SHA-1, SCRAM-SHA-256 and SCRAM-SHA-512 auth
2023-05-21 16:26:59 +09:00
Martin
9129a110df
fix syntax errors (#145)
* Fix syntax errors.

* gofmt
2023-03-03 00:20:58 +09:00
PapaTutuWawa
d72a0f3154
Implement Disco queries against other entities (#124)
* Improve support for XEP-0030

This commit allows the user to query information about the server
or a node belonging to the server as per XEP-0030.

* Fix broken PubSub functionality
2023-03-02 13:23:29 +09:00
Martin
9fc0b1236c
Print sent stanzas in debug mode. (#141)
* Print sent stanzas in debug mode.

* Remove unnecessary newline.
2023-03-02 13:22:44 +09:00
Martin
05cd75074a
success msg (#144)
* Remove unnecessary newline.

* Make success content available.

Closes #142.
2023-03-02 13:20:49 +09:00
Martin
2eb234970c
Remove unnecessary newline. (#140) 2022-07-13 07:17:24 +09:00
Martin
3b26f73300
[codespell] Fix typo. (#139) 2022-07-11 02:58:21 +09:00
milampi
1411b9cc8b
Add xml attribute support for XMLElement (#136)
* Save attributes of the xml element

* Update unittest to check xml attributes
2022-05-13 17:24:06 +09:00
Martin
99ddfc1aa4
Return all pubsub IQs. (#137)
* Return all pubsub IQs.

This makes other pubsub requests accessible via
client.Recv().

* Fix formatting (gofmt).
2022-04-10 14:46:12 +09:00
Martin
e773596ea0
Provide error replies for IQs. (#135)
This should fix #125.
2022-03-19 22:58:56 +09:00
Polynomdivision
912ba61489
Prevent crash in avatar code (#133)
* Prevent crash on empty urn:xmpp:avatar:* nodes

* Fix issue with errors

* Add a test for empty avatar pubsub items
2021-10-30 00:14:15 +09:00
tytan652
db1339b3a5
Fix host with anonymous connection (#129) 2021-07-22 23:17:14 +09:00
marzzzello
b40e129499
use ServerName to verify tls hostname (#127) 2021-01-21 17:27:23 +09:00
Steven Santos Erenst
42ee290fc5
Add the ability to customize the connection timeout (#122)
Fixes #116
2021-01-21 17:26:29 +09:00
Steven Santos Erenst
da2b7586cd
Avoid creating copies of locks (#121)
tls.Config contains fields of type sync.Once and sync.RWMutex. My understanding
is that if the copy happens to occur while the lock is in a locked state, the
lock will remain locked indefinitely and cause a deadlock. Instead use
tls.Config.Clone() to create a shallow copy.

Also the lock copy made `go vet` upset:

$ go vet ./...
./xmpp.go:242:17: assignment copies lock value to newconfig: crypto/tls.Config contains sync.Once contains sync.Mutex
./xmpp.go:530:9: assignment copies lock value to *tc: crypto/tls.Config contains sync.Once contains sync.Mutex
2021-01-21 17:25:57 +09:00
Alexander
37fa6ef92f
Implement XEP-0084 (User Avatar) (#120)
* Implement XEP-0084 (User Avatar)

* Fix style with gofmt
2021-01-21 17:24:39 +09:00
Alexander
899ef71e80
Implement a bit of XEP-0060 (PubSub) (#119)
This squashed series of commits implements basic
PubSub functionality like requesting data or
subscribing to a PubSub node.
2020-03-09 18:10:41 +09:00
Qais Patankar
3e4868bd3e
Implement OOB in Send() and add SendOOB() function for messages without body (#117)
Co-authored-by: Qais Patankar <qaisjp@gmail.com>

Co-authored-by: ValdikSS <iam@valdikss.org.ru>
2020-03-09 18:10:06 +09:00
harald-mueller
a86b6abcb3 Proxy handling / additional send method (#95)
* respect enviroment var no_proxy

* add method to send IQ messages without <query> element

* check also for uppercase NO_PROXY  env

* Uppercase NO_PROXY takes precedence over no_proxy as in HTTP_PROXY

* add comments

* revert copyright to the original one
2020-01-29 00:58:07 +09:00
mattn
ac4c216a42
Merge pull request #108 from kjx98/master
implement DNS SRV lookup for NewClient method
2020-01-29 00:56:32 +09:00
rayshih
1f614e5b8d Fix client no StartTLS & server no required 2019-01-24 15:48:01 +08:00
Jesse Kuang
ef6a1a617c keep IQ struct unchange 2019-01-15 10:53:08 +08:00
Jesse Kuang
5709ddefa8 move IQ stuff to xmpp_get_info and example 2019-01-11 11:20:54 +08:00
Jesse Kuang
51b558cd2c add urn:xmpp:time; now response jabber GetInfo 2019-01-10 23:36:50 +08:00
Jesse Kuang
66c008d798 add iq:version, iq:last 2019-01-10 22:53:01 +08:00
Jesse Kuang
1e7b50b41c add conference support 2019-01-10 14:46:50 +08:00
Jesse Kuang
c18873b880 fix query roster
process subscription="remove" roster
improve roster process
2019-01-10 10:12:39 +08:00
Jesse Kuang
2c5079ea28 fix param of tlsconn.VerifyHostname 2019-01-09 15:35:32 +08:00
Jesse Kuang
113d9c0420 implement DNS SRV lookup 2019-01-09 13:52:43 +08:00
Yasuhiro Matsumoto
e543ad3fcd
go fmt 2018-05-05 20:33:05 +09:00
Richard Phillips
4fdbee9ac5
Add 'id' to outgoing message using cnonce 2018-05-05 20:32:25 +09:00
Frank Braun
04ea54f191 introduce DebugWriter
This allows to use a different writer than os.Stderr to write debugging
output to.
2018-04-22 21:35:30 +00:00
Harald Müller
7ec2b8b7de add comments 2018-01-31 17:36:30 +09:00
Harald Müller
43e817cebe Uppercase NO_PROXY takes precedence over no_proxy as in HTTP_PROXY 2018-01-31 17:36:28 +09:00
Harald Müller
66aade104d check also for uppercase NO_PROXY env 2018-01-31 17:36:26 +09:00
Harald Müller
fda8e5cb42 respect enviroment var no_proxy 2018-01-31 17:36:22 +09:00
mattn
bd84bf7b04
Merge pull request #90 from WorksSystems/master
Add Subject and Thread for Chat
2018-01-31 10:27:03 +09:00
sshikaree
3e4f4a3a80 Move to xml.Escape() 2017-11-11 20:56:39 +03:00
Martin Hebnes Pedersen
127e75bc8b Fix neglected io.EOF handling
This was probably catched in most cases after commit 9dd92e1, but was
at best misleading as it suggested that the end of input stream signal
from xml.Decoder was intentionally ignored.

Ref mattn/go-xmpp#28
2017-11-03 13:12:33 +01:00
K.J. Kao
f3cf3c3b40 Add Subject and Thread for Chat 2017-06-13 18:51:37 +08:00
Yasuhiro Matsumoto
906d9d747d don't modify DefaultConfig 2017-04-23 19:07:54 +09:00
Vincent van Dam
a74ec7bb2d Add SendKeepAlive method to send "whitespace keepalive" 2017-03-06 15:06:43 +01:00
Yasuhiro Matsumoto
1610c524f7 check double quote also
fixes #83
2017-03-01 18:09:02 +09:00
mattn
0fe2a76e77 Merge pull request #81 from froodian/auth-failure-text
more robust error messages for authentication failures
2017-03-01 18:08:51 +09:00
Ian Leue
18cda4524c more robust error messages for authentication failures 2017-01-27 13:27:21 -05:00
lufia
f4550b5399 Add Chat.OtherElem member
Also Chat.Other member is kept as original behavior.
2016-11-21 10:25:36 +09:00
Vladimir
6265286138 Removed debug comment and extra action with an IQ query 2016-09-09 09:56:30 +05:00
Vladimir
ccac8addc9 Auto reply on server ping-request 2016-09-08 20:56:40 +05:00
james lawrence
c7af92b53b expose information queries for custom extensions 2016-06-22 12:48:40 -04:00
James Lawrence
bacbdeb205 implement discovery extension 2016-05-06 18:45:22 -04:00
mattn
12d5633a9d Merge pull request #70 from tcriess/master
Add SendPresence, add join muc with history, add function return valu…
2016-04-11 19:32:53 +09:00
David Bolshoy
e3871c2deb Xmpp ping fixed to use the obtained jid.
Though a client function, ping does not use the client jid.
Fixed ping to use the obtained jid and configured server domain by default.
Client now exposes jid.
2016-04-10 18:47:36 +03:00
Thorsten Riess
7c0791141b Add SendPresence, add join muc with history, add function return values in xmpp_muc 2016-02-04 08:17:25 +01:00
Maksim Stepanov
0e6327115f Fixed host completion in 'connect' 2016-01-16 20:28:14 +03:00
Philip Silva
adbceb5dae Recv: handle clientIQ: more terse code 2016-01-14 16:40:46 +01:00
Philip Silva
c84fc9afab Recv: handle clientIQ
When sending a successful Client-To-Server Ping, one gets a Pong that looks like this:

<iq from='capulet.lit' to='juliet@capulet.lit/balcony' id='c2s1' type='result'/>

(http://xmpp.org/extensions/xep-0199.html#c2s)
2016-01-14 14:32:03 +01:00
Eugene Agafonov
9df9a5b5f9 Remove extra allocation of XML Decoder
XML Decoder is allocated in startStream so
it overwrites the one allocated in init()
2015-12-23 23:10:12 +00:00
Silvano Luciani
188e3f03c7 Use 'any' to read cause of sasl failure. 2015-12-07 13:34:52 -08:00
chteufleur
637503f492 Do a go fmt 2015-10-16 16:24:54 +02:00
chteufleur
6618fc47ca Add Status into Presence struct 2015-10-16 13:01:30 +02:00
Joshua Martin
88f429802e Add OAuth2 support
Use provided host for certificate verification

Remove redundant ANONYMOUS mechanism support
2015-09-17 10:43:05 -07:00
mattn
222c8f8fd0 Merge pull request #56 from dullgiulio/govet
Remove unreacheable panics
2015-05-22 17:05:45 +09:00
Giulio Iotti
5f7c3b14b0 Remove unreacheable panics 2015-05-22 07:42:43 +00:00
Thomas
02e423485e Fetch latest changes 2015-05-17 00:53:09 +02:00
mattn
c8c5371616 Merge pull request #52 from jamesandariese/master
ANONYMOUS auth by default if user and password are empty.
2015-05-13 17:33:29 +09:00
Yasuhiro Matsumoto
0c0c98633c handle clientQuery 2015-04-16 20:35:08 +09:00
Yasuhiro Matsumoto
861872c8db Add Roster() 2015-04-16 20:30:36 +09:00
James Andariese
9c349bcc3f Default change to InsecureSkipVerify removed
Slipped through.  This is definitely not a good default for most people.
2015-04-13 07:50:54 -07:00
James Andariese
6c1f4b23f8 follow up from comment from mattn
s/found_anonymous/foundAnonymous/g
2015-04-12 22:28:30 -07:00
James Andariese
e8c25dcffe attempt anonymous only when logging in without JID and password 2015-04-12 22:12:16 -07:00
Egor Kovetskiy
9dd92e1247 fix eternal cycle with malicious xml packet 2015-04-10 15:30:57 +06:00
Thomas B Homburg
09fb80afad Include delay in chats 2015-02-06 23:16:32 +01:00
ThomasBS
58077b314a Add ability to send message as html 2015-01-11 03:43:24 +01:00
Teoman Soygul
050bbf66bd some formatting 2014-12-30 01:53:23 +01:00
Teoman Soygul
0d259f5448 add doc clarifications 2014-12-29 01:16:23 +01:00
Teoman Soygul
0655f5913b golint/gofmt the code 2014-12-13 15:28:57 +01:00
Stanislav Seletskiy
a60980a550 do not crash on failed connect 2014-12-11 16:49:54 +06:00
mattn
15ac96c029 Merge pull request #41 from soygul/master
Add send/sendorg return values
2014-11-17 00:00:55 +09:00
Teoman Soygul
d03bc801da add send/sendorg return values 2014-11-15 19:43:43 +01:00
Teoman Soygul
61f20ce1de fix DefaultConfig.ServerName not set when func NewClient(host...) is used 2014-11-09 14:51:33 +01:00
Mathias Gottschlag
1ff5be0d01 Only check the certificate's host name if InsecureSkipVerify is not set. 2014-10-30 23:45:15 +01:00
Scott Dunlop
1f559fafde add STARTTLS support to TCP connections
- Add InsecureAllowUnencryptedAuth to options; go-xmpp will not leak
authentication in plaintext over TCP connections (breaks compatibility
with previous versions, slightly.)
fails.
- Add StartTLS to options; go-xmpp will use STARTTLS if the server
requires it or the user requests it.
- Add IsEncrypted method so sensitive clients can check if the
connection is TLS encrypted.
2014-10-28 16:32:19 -07:00
crackcomm
aa9390a115 Status and status message 2014-10-04 18:29:19 +02:00
crackcomm
c9bbe151b2 Status message option 2014-10-04 18:22:05 +02:00
Gabriel Guzman
748282a14a Remove a declared variable that isn't used. So the library will compile again. 2014-09-17 12:27:55 +09:00
mattn
aa27e3ee45 Merge pull request #32 from hoffoo/master
TLSConfig in Options
2014-09-17 12:26:31 +09:00
Marin
f06f19e121 moved to Options instead of NewClient 2014-09-14 23:24:02 -07:00
Marin
41fd432f88 optional TLS config 2014-09-14 23:15:56 -07:00
Falaleev Maxim
0fd114068f Add anonymous auth 2014-09-15 10:12:12 +04:00
Ilya Beda
8a08b956bb Ejabberd compatibility
Add unique cookie for iq requests
Add session parameter
2014-04-23 00:05:35 +08:00
Martin Bonnin
e71f933d7c fix digest-md5 with some ejabberd server
* it looke like some response parameters need to be quoted
* so quote username, realm, nonce, etc, ... as in http://tools.ietf.org/html/rfc3920#ref-SASL
2014-04-16 17:25:20 +02:00
Specode
8a80c8abe3 fix bug 2013-11-05 10:03:26 +08:00
Specode
b67dc40516 fix some error handling 2013-11-04 15:13:55 +08:00
Specode
64821d5df9 clientMessage add ",any" tag, use for hasn't matched element 2013-10-30 17:14:11 +08:00
Specode
cbdf478ba7 clientMessage add ",any" tag, use for hasn't matched element 2013-10-30 17:13:02 +08:00
Specode
c88c22763a add SendOrg for send origin text 2013-10-18 15:52:01 +08:00
Specode
af110491a0 add debug options 2013-10-18 15:49:41 +08:00
Scott Dunlop
7c9260e5a0 added the normal arguments to NewClient to Options and made that a central entrypoint for creating new clients 2013-08-12 16:04:39 -07:00