File: show_own_jid.patch

package info (click to toggle)
coccinella 0.96.20-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,108 kB
  • ctags: 5,908
  • sloc: tcl: 124,744; xml: 206; makefile: 66; sh: 62
file content (135 lines) | stat: -rw-r--r-- 4,828 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
Index: jabber/RosterTree.tcl
===================================================================
--- jabber/RosterTree.tcl	(revision 2837)
+++ jabber/RosterTree.tcl	(working copy)
@@ -1472,6 +1472,12 @@
     }
     
     # Filter out those we don't want to see.
+    set isownjid [::Roster::IsOwnJID $jid]
+    if {isownjid} {
+	if {!$jprefs(rost,showOwnJID)} {
+	    return
+	}
+    }
     set istrpt [::Roster::IsTransportEx $jid]
     if {$istrpt} {
 	if {!$jprefs(rost,showTrpts)} {
Index: jabber/Roster.tcl
===================================================================
--- jabber/Roster.tcl	(revision 2840)
+++ jabber/Roster.tcl	(working copy)
@@ -130,6 +130,7 @@
 	{separator}
 	{cascade     mStyle           {[mc "Style"]} {@::Roster::StyleMenu} }
 	{cascade     mShow            {[mc "Show"]} {
+	    {check     mOwnJID        {[mc "Own Resource"]} {::Roster::ShowOwnJID}    {-variable ::jprefs(rost,showOwnJID)} }
 	    {check     mOffline       {[mc "&Offline"]} {::Roster::ShowOffline}    {-variable ::jprefs(rost,showOffline)} }
 	    {check     mDoNotDisturb  {[mc "Do Not Disturb"]} {::Roster::ShowDnD}        {-variable ::jprefs(rost,show-dnd)} }
 	    {check     mAway          {[mc "Away"]} {::Roster::ShowAway}       {-variable ::jprefs(rost,show-away)} }
@@ -154,6 +155,7 @@
 	{mHistory...      {user always}         }
 	{mRemoveContact   {user}                }
 	{mShow            {normal}              {
+	    {mOwnJID              {normal}          }
 	    {mOffline             {normal}          }
 	    {mDoNotDisturb        {normal}          }
 	    {mAway                {normal}          }
@@ -407,7 +409,12 @@
     if {[string equal $ans "yes"]} {
 	foreach jid $jidL {
 	    set jid [::Jabber::Jlib roster getrosterjid $jid]
-	    ::Jabber::Jlib roster send_remove $jid
+	    if {[IsOwnJID $jid]} {
+::Debug 2 "::Roster::RemoveJIDList removing own JID"
+	    } else {
+::Debug 2 "::Roster::RemoveJIDList removing foreign JID" 
+	    	::Jabber::Jlib roster send_remove $jid
+	    }
 	}
     }
 }
@@ -1193,6 +1200,10 @@
     ::Jabber::SetStatus unavailable -to $jid3    
 }
 
+proc ::Roster::ShowOwnJID {} {
+    RepopulateTree
+}
+
 proc ::Roster::ShowOffline {} {
     RepopulateTree
 }
@@ -1493,6 +1504,16 @@
     return $transport
 }
 
+proc ::Roster::IsOwnJID {jid} {
+    set myjid [::Jabber::Jlib myjid2]
+    if {[string equal $jid $myjid]} {
+	set isownjid 1
+    } else {
+	set isownjid 0
+    }
+    return $isownjid
+}
+
 #-------------------------------------------------------------------------------
 
 proc ::Roster::GetUsersWithSameHost {jid} {
@@ -1550,10 +1571,11 @@
     set jprefs(rost,clrLogout)      1
     set jprefs(rost,dblClk)         chat
     set jprefs(rost,showOffline)    1
+    set jprefs(rost,showOwnJID)     0
     set jprefs(rost,showTrpts)      1
-    set jprefs(rost,show-dnd)        1
-    set jprefs(rost,show-away)       1
-    set jprefs(rost,show-xa)         1
+    set jprefs(rost,show-dnd)       1
+    set jprefs(rost,show-away)      1
+    set jprefs(rost,show-xa)        1
     set jprefs(rost,showSubNone)    1
     set jprefs(rost,sort)           -increasing
     
@@ -1572,6 +1594,7 @@
       [list jprefs(rost,rmIfUnsub)   jprefs_rost_rmIfUnsub    $jprefs(rost,rmIfUnsub)]  \
       [list jprefs(rost,showSubNone) jprefs_rost_showSubNone  $jprefs(rost,showSubNone)]  \
       [list jprefs(rost,showOffline) jprefs_rost_showOffline  $jprefs(rost,showOffline)]  \
+      [list jprefs(rost,showOwnJID)  jprefs_rost_showOwnJID   $jprefs(rost,showOwnJID)]  \
       [list jprefs(rost,showTrpts)   jprefs_rost_showTrpts    $jprefs(rost,showTrpts)]  \
       [list jprefs(rost,show-dnd)    jprefs_rost_show-dnd     $jprefs(rost,show-dnd)]  \
       [list jprefs(rost,show-away)   jprefs_rost_show-away    $jprefs(rost,show-away)]  \
@@ -1598,7 +1621,7 @@
     variable tmpJPrefs
     
     foreach key {
-	rmIfUnsub showSubNone clrLogout dblClk showOffline showTrpts
+	rmIfUnsub showSubNone clrLogout dblClk showOffline showOwnJID showTrpts
     } {
 	set tmpJPrefs(rost,$key) $jprefs(rost,$key)
     }
@@ -1651,6 +1674,10 @@
 	set jprefs(rost,showSubNone) $tmpJPrefs(rost,showSubNone)
 	set repopulatetree 1
     }
+    if {$jprefs(rost,showOwnJID) != $tmpJPrefs(rost,showOwnJID)} {
+	set jprefs(rost,showOwnJID) $tmpJPrefs(rost,showOwnJID)
+	set repopulatetree 1
+    }
     if {$repopulatetree eq 1} {
 	RepopulateTree
     }
Index: Coccinella.tcl
===================================================================
--- Coccinella.tcl	(revision 2837)
+++ Coccinella.tcl	(working copy)
@@ -13,7 +13,7 @@
 # $Id: Coccinella.tcl,v 1.188 2008-08-19 14:06:27 matben Exp $	
 
 # Level of detail for printouts; >= 2 for my outputs; >= 6 to logfile.
-set debugLevel 0
+set debugLevel 10
 
 # TclKit loading mechanism.
 package provide app-Coccinella 1.0