From a71d9a4f7d91934e385cdbb37d55e7a6b6c6e5bd Mon Sep 17 00:00:00 2001
From: Joe <rbo@gmx.us>
Date: Mon, 15 Jan 2024 20:20:20 +0100
Subject: fuck ids

---
 c_init.go   |  1 -
 c_ldirs.go  | 57 ---------------------------------------------------------
 c_lhosts.go | 24 ------------------------
 i_ui.go     |  7 -------
 4 files changed, 89 deletions(-)

diff --git a/c_init.go b/c_init.go
index 961a1fb..e8dfd97 100644
--- a/c_init.go
+++ b/c_init.go
@@ -71,7 +71,6 @@ func c_recurse_data_dir(dir, root string, opts HardOpts,
 		c_die("could not read data directory", err)
 	}
 	dir_node := DirsNode{
-		0,
 		name,
 		parent,
 		depth,
diff --git a/c_ldirs.go b/c_ldirs.go
index 77f017d..b2978f3 100644
--- a/c_ldirs.go
+++ b/c_ldirs.go
@@ -52,7 +52,6 @@
 package main
 
 type DirsNode struct {
-	ID     int
 	Name   string
 	Parent *DirsNode
 	Depth  uint16
@@ -73,7 +72,6 @@ func (ldirs *DirsList) add_back(node *DirsNode) {
 		return
 	}
 	last := ldirs.last
-	node.ID = last.ID + 1
 	last.next = node
 	ldirs.last = last.next
 }
@@ -89,9 +87,6 @@ func (ldirs *DirsList) del(dir *DirsNode) {
 			ldirs.last = nil
 			return
 		}
-		for ptr := ldirs.head; ptr != nil; ptr = ptr.next {
-			ptr.ID -= 1
-		}
 		return
 	}
 	if ldirs.last == dir {
@@ -110,25 +105,6 @@ func (ldirs *DirsList) del(dir *DirsNode) {
 	if ptr.next == dir {
 		ptr.next = ptr.next.next
 	}
-	for ptr := ptr.next; ptr != nil; ptr = ptr.next {
-		ptr.ID -= 1
-	}
-}
-
-// return the list node with the according id
-func (ldirs *DirsList) sel(id int) *DirsNode {
-	curr := ldirs.head
-
-	if curr == nil {
-		return nil
-	}
-    for curr.next != nil && curr.ID != id {
-        curr = curr.next
-    }
-	if curr.ID != id {
-		return nil
-	}
-	return curr
 }
 
 // returns a string with the full path of the dir
@@ -146,14 +122,6 @@ func (dir *DirsNode) path() string {
 	return path
 }
 
-// returns the number of hosts of the dir
-func (dir *DirsNode) count_hosts() int {
-	if dir.lhost.head == nil || dir.lhost.last == nil {
-		return 0
-	}
-	return dir.lhost.last.ID + 1
-}
-
 func (ldirs *DirsList) prev(dir *DirsNode) *DirsNode {
 	if ldirs.head == dir {
 		return dir
@@ -165,28 +133,3 @@ func (ldirs *DirsList) prev(dir *DirsNode) *DirsNode {
 	}
 	return nil
 }
-// return the number of hosts and subfolders of the dir
-// func (item *ItemsNode) count_elements(skip_folds bool,
-// 	folds map[*DirsNode]*ItemsList) (*ItemsNode, int) {
-// 	if item.is_dir() == false || item.Dirs == nil {
-// 		return nil, 0
-// 	}
-// 	items := 0
-//
-// 	items += item.Dirs.count_hosts()
-// 	for ptr := item; ptr != nil; ptr = ptr.next {
-// 		ptr.Dirs.Depth > item.Dirs.Depth
-// 	}
-// 	for ptr := dir.next; ptr != nil && ptr.Depth > dir.Depth; ptr = ptr.next {
-// 		if lfold := folds[ptr]; skip_folds == true && lfold != nil {
-// 			count := lfold.last.ID - lfold.head.ID
-// 			for i := 0; ptr != nil && i < count; i++ {
-// 				ptr = ptr.next
-// 			}
-// 		} else {
-// 			items += ptr.count_hosts() + 1
-// 		}
-// 	}
-// 	return items
-// 	// FIX: this needs fixin
-// }
diff --git a/c_lhosts.go b/c_lhosts.go
index 2e99264..654da13 100644
--- a/c_lhosts.go
+++ b/c_lhosts.go
@@ -54,7 +54,6 @@ package main
 // 0: ssh
 // 1: rdp
 type HostNode struct {
-	ID       int
 	Protocol int8   `yaml:"type"`
 	Name     string `yaml:"name"`
 	Host     string `yaml:"host"`
@@ -91,7 +90,6 @@ func (lhost *HostList) add_back(node *HostNode) {
 		return
 	}
 	last := lhost.last
-	node.ID = last.ID + 1
 	last.next = node
 	lhost.last = last.next
 }
@@ -107,9 +105,6 @@ func (lhost *HostList) del(host *HostNode) {
 			lhost.last = nil
 			return
 		}
-		for ptr := lhost.head; ptr != nil; ptr = ptr.next {
-			ptr.ID -= 1
-		}
         return
     }
 	if lhost.last == host {
@@ -128,25 +123,6 @@ func (lhost *HostList) del(host *HostNode) {
     if ptr.next == host {
         ptr.next = ptr.next.next
     }
-	for ptr := ptr.next; ptr != nil; ptr = ptr.next {
-		ptr.ID -= 1
-	}
-}
-
-// returns the list node with the according id
-func (lhost *HostList) sel(id int) *HostNode {
-	curr := lhost.head
-
-	if curr == nil {
-		return nil
-	}
-    for curr.next != nil && curr.ID != id {
-        curr = curr.next
-    }
-	if curr.ID != id {
-		return nil
-	}
-	return curr
 }
 
 func (lhost *HostList) count() int {
diff --git a/i_ui.go b/i_ui.go
index c3e1793..c545e5a 100644
--- a/i_ui.go
+++ b/i_ui.go
@@ -341,13 +341,6 @@ func i_info_panel_dirs(ui HardUI, dir *DirsNode) {
 	i_draw_text(ui.s,
 		(ui.dim[W] / 3) + 10, curr_line, ui.dim[W] - 2, curr_line,
 		ui.def_style, dir.path())
-	curr_line += 1
-	i_draw_text(ui.s,
-		(ui.dim[W] / 3) + 4, curr_line, ui.dim[W] - 2, curr_line,
-		ui.title_style, "Hosts: ")
-	i_draw_text(ui.s,
-		(ui.dim[W] / 3) + 11, curr_line, ui.dim[W] - 2, curr_line,
-		ui.def_style, strconv.Itoa(dir.count_hosts()))
 }
 
 func i_info_panel(ui HardUI, litems *ItemsList) {
-- 
cgit v1.2.3