From 1d79f0f8ac7b57715248daf66260463e9220cd85 Mon Sep 17 00:00:00 2001 From: BioS <> Date: Thu, 29 Dec 2016 12:44:32 +0000 Subject: [PATCH] feature: 70_Jabber Added possibility to change componentname via attr JabberDomain git-svn-id: https://svn.fhem.de/fhem/trunk@12904 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/70_Jabber.pm | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index d5fcb4f13..90e35b750 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 70_Jabber Added possibility to change componentname via + attr JabberDomain - feature: 93_DbRep: function readingRename added, delEntries is able to use SQL-Wildcards in attr reading/device - bugfix: 98_Verkehrsinfo.pm: Fix state update, Hessenschau message diff --git a/fhem/FHEM/70_Jabber.pm b/fhem/FHEM/70_Jabber.pm index 2c4e1cc51..905642380 100644 --- a/fhem/FHEM/70_Jabber.pm +++ b/fhem/FHEM/70_Jabber.pm @@ -23,9 +23,10 @@ # You should have received a copy of the GNU General Public License # along with fhem. If not, see . # -# Version: 1.6 - 2015-09-17 +# Version: 1.7 - 2016-12-29 # # Changelog: +# v1.7 2016-12-29 Added possibility to change componentname via attr JabberDomain (thx Turbokid) # v1.6 2016-07-10 Fix log message if otr message is empty (thx spikeh1) # v1.5 2015-09-17 Added OTR (Off the Record) end to end encryption # Added MUC (Multi-User-Channel) joining and handling @@ -87,7 +88,7 @@ Jabber_Initialize($) $hash->{DefFn} = "Jabber_Define"; $hash->{UndefFn} = "Jabber_UnDef"; $hash->{AttrFn} = "Jabber_Attr"; - $hash->{AttrList} = "dummy:1,0 loglevel:0,1,2,3,4,5 OnlineStatus:available,unavailable PollTimer RecvWhitelist ResourceName MucJoin MucRecvWhitelist OTREnable OTRSharedSecret ".$readingFnAttributes; + $hash->{AttrList} = "dummy:1,0 loglevel:0,1,2,3,4,5 OnlineStatus:available,unavailable PollTimer RecvWhitelist ResourceName MucJoin MucRecvWhitelist OTREnable OTRSharedSecret JabberDomain ".$readingFnAttributes; } ################################### @@ -303,6 +304,9 @@ Jabber_Attr(@) } } elsif ($aName eq "OTRSharedSecret") { #Nothing special to do will be used later.. + } elsif ($aName eq "JabberDomain" && $init_done) { + #restart connection... + $hash->{JabberDevice}->Disconnect(); } } return undef; @@ -546,13 +550,19 @@ sub Jabber_CheckConnection($) } if (!$hash->{JabberDevice}->Connected()) { + + my $componentname = $hash->{helper}{server}; + if(exists($attr{$name}{JabberDomain}) && $attr{$name}{JabberDomain} ne '') { + $componentname = $attr{$name}{JabberDomain}; + } + my $connectionstatus = $hash->{JabberDevice}->Connect( hostname=>$hash->{helper}{server}, port=>$hash->{helper}{port}, tls=>$hash->{helper}{tls}, ssl=>$hash->{helper}{ssl}, - componentname=>$hash->{helper}{server} + componentname=>$componentname ); if (!defined($connectionstatus)) { @@ -954,6 +964,9 @@ sub Jabber_OTR_disconnected { =pod +=item device +=item summary connect FHEM to the Jabber Network, send and receiving messages +=item summary_DE verbindet FHEM and Jabber Netz, kann Nachrichten senden und empfangen =begin html